-
Notifications
You must be signed in to change notification settings - Fork 2.2k
chore(relayer): restore relayer CI (#1192) #2196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f8bd4f0
chore(relayer): restore relayer CI (#1192)
paulo-zama e7f4309
chore(relayer): restore relayer CI (#1192)
paulo-zama bc53ae6
chore(relayer): restore relayer CI (#1192)
paulo-zama fdc27e9
chore(relayer): restore relayer CI (#1192)
paulo-zama 4042dd4
chore(relayer): restore relayer CI (#1192)
paulo-zama 36df620
chore(relayer): restore relayer CI (#1192)
paulo-zama eaef596
chore(relayer): restore relayer CI (#1192)
paulo-zama ec86cde
chore(relayer): restore relayer CI (#1192)
paulo-zama 2d44b0c
chore(relayer): restore relayer CI (#1192)
paulo-zama 194fd18
chore(relayer): restore relayer CI (#1192)
paulo-zama a84c945
chore(relayer): restore relayer CI (#1192)
paulo-zama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: relayer-dependency-analysis | ||
|
|
||
| permissions: {} | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: fhevm-relayer-deps-analysis-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| jobs: | ||
| check-changes: | ||
| name: relayer-dependency-analysis/check-changes | ||
| permissions: | ||
| actions: 'read' # Required to read workflow run information | ||
| contents: 'read' # Required to checkout repository code | ||
| pull-requests: 'read' # Required to read pull request information | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| changes-rust-files: ${{ steps.filter.outputs.rust-files }} | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: 'false' | ||
| - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | ||
| id: filter | ||
| with: | ||
| filters: | | ||
| rust-files: | ||
| - .github/workflows/relayer-dependency-analysis.yml | ||
| - relayer/** | ||
| dependencies-check: | ||
| name: relayer-dependency-analysis/dependencies-check (bpr) | ||
| needs: check-changes | ||
| if: ${{ needs.check-changes.outputs.changes-rust-files == 'true' }} | ||
| permissions: | ||
| contents: 'read' # Required to checkout repository code | ||
| checks: 'write' # Required to create GitHub checks for test results | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
|
||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: 'false' | ||
|
|
||
| - name: Setup Rust toolchain file | ||
| run: cp relayer/rust-toolchain.toml . | ||
|
|
||
| - name: Rust setup | ||
| uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1 | ||
|
|
||
| - name: Install cargo-binstall | ||
| uses: cargo-bins/cargo-binstall@84ca29d5c1719e79e23b6af147555a8f4dac79d6 # v1.10.14 | ||
|
|
||
| - name: Install cargo tools | ||
| run: | | ||
| cargo binstall --no-confirm --force \ | ||
| cargo-audit@0.22.0 \ | ||
| cargo-deny@0.16.2 | ||
|
|
||
| - name: Check that Cargo.lock is the source of truth | ||
| run: | | ||
| cd relayer | ||
| cargo update -w --locked || (echo "Error: Cargo.lock is out of sync. Please run 'cargo update' locally and commit changes" && exit 1) | ||
|
|
||
| - name: License whitelist | ||
| run: | | ||
| cd relayer | ||
| cargo-deny deny check license --deny license-not-encountered | ||
|
|
||
| - name: Security issue whitelist | ||
| run: | | ||
| cd relayer | ||
| cargo-audit audit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| name: relayer-test | ||
|
|
||
| # NOTE: could be parametrized with which package to test when we have a specific transaction manager different from the relayer itself. | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| jobs: | ||
| check-changes: | ||
| name: relayer-test/check-changes | ||
| permissions: | ||
| actions: 'read' # Required to read workflow run information | ||
| contents: 'read' # Required to checkout repository code | ||
| pull-requests: 'read' # Required to read pull request information | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| changes-rust-files: ${{ steps.filter.outputs.rust-files }} | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: 'false' | ||
| - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | ||
| id: filter | ||
| with: | ||
| filters: | | ||
| rust-files: | ||
| - .github/workflows/relayer-tests.yaml | ||
| - relayer/** | ||
|
|
||
| unit-test: | ||
| name: relayer-test/unit-test (bpr) | ||
| needs: check-changes | ||
| if: ${{ needs.check-changes.outputs.changes-rust-files == 'true' }} | ||
| permissions: | ||
| contents: 'read' # Required to checkout repository code | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Project | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
| token: ${{ secrets.BLOCKCHAIN_ACTIONS_TOKEN }} | ||
| submodules: recursive | ||
|
|
||
| - name: Setup Rust toolchain file | ||
| run: cp relayer/rust-toolchain.toml . | ||
|
|
||
| - name: Rust setup | ||
| uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1 | ||
|
|
||
| - name: Cache Rust dependencies and build artifacts | ||
| uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | ||
| with: | ||
| workspaces: relayer | ||
| key: rust-build-relayer | ||
| cache-targets: true | ||
| cache-all-crates: true | ||
|
|
||
| - name: Format | ||
| working-directory: relayer | ||
| run: cargo fmt --all -- --check | ||
|
|
||
| - name: Build for tests (no rpc mock) | ||
| working-directory: relayer | ||
| run: cargo test --no-run --lib | ||
|
|
||
| - name: Unit tests | ||
| working-directory: relayer | ||
| run: RUST_BACKTRACE=full make test-unit | ||
|
|
||
| clippy: | ||
| name: relayer-test/clippy (bpr) | ||
| needs: check-changes | ||
| if: ${{ needs.check-changes.outputs.changes-rust-files == 'true' }} | ||
| permissions: | ||
| contents: 'read' # Required to checkout repository code | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Project | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
| token: ${{ secrets.BLOCKCHAIN_ACTIONS_TOKEN }} | ||
| submodules: recursive | ||
|
|
||
| - name: Setup Rust toolchain file | ||
| run: cp relayer/rust-toolchain.toml . | ||
|
|
||
| - name: Setup Rust | ||
| uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1 | ||
|
|
||
| - name: Cache Rust dependencies | ||
| uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | ||
| with: | ||
| workspaces: relayer | ||
| key: rust-build-relayer | ||
|
|
||
| - name: Clippy | ||
| working-directory: relayer | ||
| run: cargo clippy -- -D warnings | ||
|
|
||
| integration-test: | ||
| name: relayer-test/integration-test (bpr) | ||
| needs: check-changes | ||
| if: ${{ needs.check-changes.outputs.changes-rust-files == 'true' }} | ||
| permissions: | ||
| contents: 'read' # Required to checkout repository code | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| postgres: | ||
| image: cgr.dev/zama.ai/postgres:17.9@sha256:d42847b7c5f9ece73655164588b2387dcd5fadd618ea64761c19d3484498cef0 | ||
| credentials: | ||
| username: ${{ secrets.CGR_USERNAME }} | ||
| password: ${{ secrets.CGR_PASSWORD }} | ||
| env: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_DB: relayer_db | ||
| ports: | ||
| - 5432 | ||
| options: >- | ||
| --health-cmd "pg_isready -U postgres -d relayer_db" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| env: | ||
| SQLX_OFFLINE: true # Use cached queries for compilation (speeds up CI) | ||
| APP_GLOBAL__MOCK_TEST: true | ||
| DB_USER: postgres | ||
| DB_PASSWORD: postgres | ||
| DB_NAME: relayer_db | ||
|
|
||
| steps: | ||
| - name: Checkout Project | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
| token: ${{ secrets.BLOCKCHAIN_ACTIONS_TOKEN }} | ||
| submodules: recursive | ||
|
|
||
| - name: Set database URLs | ||
| env: | ||
| DB_PORT: ${{ job.services.postgres.ports['5432'] }} | ||
| run: | | ||
| { | ||
| echo "DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}" | ||
| echo "APP_STORAGE__SQL_DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}" | ||
| echo "TEST_DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@localhost:${DB_PORT}/${DB_NAME}" | ||
| } >> "$GITHUB_ENV" | ||
|
|
||
| - name: Setup Rust toolchain file | ||
| run: cp relayer/rust-toolchain.toml . | ||
|
|
||
| - name: Setup Rust | ||
| uses: dsherret/rust-toolchain-file@3551321aa44dd44a0393eb3b6bdfbc5d25ecf621 # v1 | ||
|
|
||
| - name: Cache Rust dependencies and build artifacts | ||
| uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2 | ||
| with: | ||
| workspaces: relayer | ||
| key: rust-build-relayer | ||
| cache-targets: true | ||
| cache-all-crates: true | ||
|
|
||
| - name: Install SQLx CLI | ||
| run: | | ||
| if ! command -v sqlx &> /dev/null; then | ||
| echo "Installing sqlx-cli..." | ||
| cargo install sqlx-cli --no-default-features --features postgres | ||
| else | ||
| echo "sqlx-cli found in cache." | ||
| fi | ||
|
|
||
| - name: Migrate Database | ||
| working-directory: relayer/relayer-migrate | ||
| run: sqlx migrate run | ||
|
|
||
| - name: Run tests | ||
| working-directory: relayer | ||
| run: RUST_BACKTRACE=full make test-run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [toolchain] | ||
| channel = "1.91.1" | ||
| components = ["rustfmt", "clippy"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.