Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,59 @@ jobs:
format:
name: Auto Format
runs-on: ubuntu-latest
# Skip if:
# - PR from fork (can't push back)
# - Commit by github-actions[bot] (prevent infinite loop)
if: |
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) &&
github.actor != 'github-actions[bot]'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
# Use PAT to trigger downstream workflows; fallback to GITHUB_TOKEN
path: meta_git_lib
token: ${{ secrets.PARENT_REPO_PAT || github.token }}

- name: Clone dependencies
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
for repo in meta_core meta_cli meta_plugin_protocol loop_lib; do
if git clone --depth 1 -b "$BRANCH" "https://github.com/harmony-labs/${repo}.git" 2>/dev/null; then
echo "Cloned ${repo}@${BRANCH}"
elif git clone --depth 1 "https://github.com/harmony-labs/${repo}.git"; then
echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch"
else
echo "::error::Failed to clone ${repo}"
exit 1
fi
done
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Create workspace Cargo.toml
run: |
cat > Cargo.toml << 'EOF'
[workspace]
members = ["meta_git_lib", "meta_core", "meta_cli", "meta_plugin_protocol", "loop_lib"]
resolver = "2"

[workspace.package]
version = "0.1.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/harmony-labs/meta"
EOF
Comment thread
mateodelnorte marked this conversation as resolved.

- name: Create VERSION file
run: echo "0.0.0-ci" > VERSION

- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Run cargo fmt
working-directory: meta_git_lib
run: cargo fmt --all

- name: Check for changes
id: changes
working-directory: meta_git_lib
run: |
if git diff --quiet; then
echo "formatted=false" >> $GITHUB_OUTPUT
Expand All @@ -48,6 +79,7 @@ jobs:

- name: Commit and push
if: steps.changes.outputs.formatted == 'true'
working-directory: meta_git_lib
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
Expand Down
103 changes: 95 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,38 @@ jobs:

- name: Clone dependencies
shell: bash
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
git clone --depth 1 https://github.com/harmony-labs/meta_core.git
git clone --depth 1 https://github.com/harmony-labs/meta_cli.git
git clone --depth 1 https://github.com/harmony-labs/meta_plugin_protocol.git
git clone --depth 1 https://github.com/harmony-labs/loop_lib.git
for repo in meta_core meta_cli meta_plugin_protocol loop_lib; do
if git clone --depth 1 -b "$BRANCH" "https://github.com/harmony-labs/${repo}.git" 2>/dev/null; then
echo "Cloned ${repo}@${BRANCH}"
elif git clone --depth 1 "https://github.com/harmony-labs/${repo}.git"; then
echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch"
else
echo "::error::Failed to clone ${repo}"
exit 1
fi
done

- name: Create workspace Cargo.toml
shell: bash
run: |
cat > Cargo.toml << 'EOF'
[workspace]
members = ["meta_git_lib", "meta_core", "meta_cli", "meta_plugin_protocol", "loop_lib"]
resolver = "2"

[workspace.package]
version = "0.1.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/harmony-labs/meta"
EOF
Comment thread
mateodelnorte marked this conversation as resolved.

- name: Create VERSION file
shell: bash
run: echo "0.0.0-ci" > VERSION
Comment thread
mateodelnorte marked this conversation as resolved.

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand All @@ -53,11 +80,36 @@ jobs:
path: meta_git_lib

- name: Clone dependencies
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
for repo in meta_core meta_cli meta_plugin_protocol loop_lib; do
if git clone --depth 1 -b "$BRANCH" "https://github.com/harmony-labs/${repo}.git" 2>/dev/null; then
echo "Cloned ${repo}@${BRANCH}"
elif git clone --depth 1 "https://github.com/harmony-labs/${repo}.git"; then
echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch"
else
echo "::error::Failed to clone ${repo}"
exit 1
fi
done

- name: Create workspace Cargo.toml
run: |
git clone --depth 1 https://github.com/harmony-labs/meta_core.git
git clone --depth 1 https://github.com/harmony-labs/meta_cli.git
git clone --depth 1 https://github.com/harmony-labs/meta_plugin_protocol.git
git clone --depth 1 https://github.com/harmony-labs/loop_lib.git
cat > Cargo.toml << 'EOF'
[workspace]
members = ["meta_git_lib", "meta_core", "meta_cli", "meta_plugin_protocol", "loop_lib"]
resolver = "2"

[workspace.package]
version = "0.1.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/harmony-labs/meta"
EOF

- name: Create VERSION file
run: echo "0.0.0-ci" > VERSION

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand All @@ -79,11 +131,46 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
with:
path: meta_git_lib

- name: Clone dependencies
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
for repo in meta_core meta_cli meta_plugin_protocol loop_lib; do
if git clone --depth 1 -b "$BRANCH" "https://github.com/harmony-labs/${repo}.git" 2>/dev/null; then
echo "Cloned ${repo}@${BRANCH}"
elif git clone --depth 1 "https://github.com/harmony-labs/${repo}.git"; then
echo "Branch ${BRANCH} not found for ${repo}; falling back to default branch"
else
echo "::error::Failed to clone ${repo}"
exit 1
fi
done

- name: Create workspace Cargo.toml
run: |
cat > Cargo.toml << 'EOF'
[workspace]
members = ["meta_git_lib", "meta_core", "meta_cli", "meta_plugin_protocol", "loop_lib"]
resolver = "2"

[workspace.package]
version = "0.1.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/harmony-labs/meta"
EOF

- name: Create VERSION file
run: echo "0.0.0-ci" > VERSION

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Check formatting
working-directory: meta_git_lib
run: cargo fmt --all -- --check
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ chrono = { version = "0.4", features = ["serde"] }
log = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
serde_yaml_ng = "0.10"

[dev-dependencies]
tempfile = "3.3"
Expand Down
Loading