Merge pull request #431 from namada-net/update-version-4.0.4 #1342
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
| name: Check Stuff 👨🔧 | |
| on: | |
| merge_group: | |
| pull_request: | |
| branches: | |
| - main | |
| - '*-maint' | |
| push: | |
| branches: | |
| - main | |
| - '*-maint' | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| permissions: | |
| packages: write | |
| pages: write | |
| id-token: write | |
| contents: read | |
| jobs: | |
| clippy: | |
| if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: taiki-e/install-action@just | |
| - uses: rui314/setup-mold@v1 | |
| - uses: heliaxdev/setup-protoc@v2 | |
| with: | |
| version: "25.0" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - id: rust_toolchain | |
| run: echo "version=$(cat $GITHUB_WORKSPACE/rust-stable-version | tr -d '\n')" >> $GITHUB_OUTPUT | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ steps.rust_toolchain.outputs.version }} | |
| components: clippy | |
| cache: true | |
| - run: just clippy | |
| test: | |
| if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: password | |
| PGUSER: postgres | |
| POSTGRES_DB: namada-indexer | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: taiki-e/install-action@just | |
| - uses: rui314/setup-mold@v1 | |
| - uses: heliaxdev/setup-protoc@v2 | |
| with: | |
| version: "25.0" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - id: rust_toolchain | |
| run: echo "version=$(cat $GITHUB_WORKSPACE/rust-stable-version | tr -d '\n')" >> $GITHUB_OUTPUT | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ steps.rust_toolchain.outputs.version }} | |
| cache: true | |
| - run: just test | |
| env: | |
| DATABASE_URL_TEST: postgres://postgres:password@0.0.0.0:5432 | |
| validate-swagger: | |
| runs-on: ubuntu-latest | |
| name: Validate Swagger | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Validate OpenAPI definition | |
| uses: swaggerexpert/swagger-editor-validate@v1 | |
| with: | |
| definition-file: swagger.yml | |
| format: | |
| if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: taiki-e/install-action@just | |
| - uses: rui314/setup-mold@v1 | |
| - uses: heliaxdev/setup-protoc@v2 | |
| with: | |
| version: "25.0" | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - id: rust_toolchain | |
| run: echo "version=$(cat $GITHUB_WORKSPACE/rust-nightly-version | tr -d '\n')" >> $GITHUB_OUTPUT | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ steps.rust_toolchain.outputs.version }} | |
| components: rustfmt | |
| cache: true | |
| - run: just fmt-check | |
| docker: | |
| name: Docker | |
| runs-on: ubuntu-latest | |
| # if: ${{ github.event_name == 'merge_group' || github.event_name == 'pull_request' }} | |
| env: | |
| GIT_LFS_SKIP_SMUDGE: 1 | |
| REGISTRY_URL: ghcr.io | |
| REPOSITORY: ${{ github.repository }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| docker: | |
| [ | |
| { image: chain, package: chain }, | |
| { image: governance, package: governance }, | |
| { image: pos, package: pos }, | |
| { image: rewards, package: rewards }, | |
| { image: webserver, package: webserver }, | |
| { image: parameters, package: parameters }, | |
| { image: transactions, package: transactions }, | |
| { image: cometbft, package: cometbft }, | |
| ] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY_URL }}/${{ env.REPOSITORY }} | |
| flavor: | | |
| latest=auto | |
| prefix=${{ matrix.docker.image }} | |
| suffix= | |
| tags: | | |
| type=ref,event=branch,prefix=${{ matrix.docker.image }}-branch- | |
| type=ref,event=pr,prefix=${{ matrix.docker.image }}-pr- | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push | |
| id: push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| build-args: PACKAGE=${{ matrix.docker.package }} | |
| push: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha, scope=${{ matrix.docker.image }}, mode=max | |
| cache-to: type=gha, scope=${{ matrix.docker.image }}, mode=max | |
| can_enqueue: | |
| needs: [clippy, format, docker, validate-swagger] | |
| if: always() && github.event_name != 'merge_group' | |
| permissions: | |
| actions: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - env: | |
| NEEDS_JSON: "${{toJSON(needs)}}" | |
| name: Transform outcomes | |
| run: | | |
| echo "ALL_SUCCESS=$(echo "$NEEDS_JSON" | jq '. | to_entries | map([.value.result == "success", .value.result == "skipped"] | any) | all')" >> $GITHUB_ENV | |
| - name: check outcomes | |
| run: "[ $ALL_SUCCESS == true ]" | |
| can_merge: | |
| needs: [clippy, format, docker, validate-swagger] | |
| if: always() && github.event_name == 'merge_group' | |
| permissions: | |
| contents: read | |
| pages: write | |
| actions: read | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - env: | |
| NEEDS_JSON: "${{toJSON(needs)}}" | |
| name: Transform outcomes | |
| run: | | |
| echo "ALL_SUCCESS=$(echo "$NEEDS_JSON" | jq '. | to_entries | map([.value.result == "success", .value.result == "skipped"] | any) | all')" >> $GITHUB_ENV | |
| - name: check outcomes | |
| run: "[ $ALL_SUCCESS == true ]" |