Upgrade to latest polkadot with frequency _1.17.8_ #1768
Workflow file for this 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
| name: Build and Test | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| service-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changes: ${{ steps.determine-matrix.outputs.changes }} | |
| # IF you add a new filter it ALSO needs to be here | |
| services: >- | |
| ["account", "content-publishing", "content-watcher", "graph", "libs"] | |
| # Resolves to true if it should run everything, aka when common files change | |
| run-all: ${{ contains(fromJson(steps.determine-matrix.outputs.changes), 'common') }} | |
| steps: | |
| - name: Check Out Repo | |
| uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: determine-matrix | |
| with: | |
| # Adding a filter? Check for the need to add to the outputs as well | |
| filters: | | |
| common: | |
| - 'Docker/**' | |
| - '.github/**' | |
| - '*.sh' | |
| - 'docker-compose.yaml' | |
| - 'docker-compose.local-frequency.yaml' | |
| - 'docker-compose-published.yaml' | |
| - 'libs/blockchain/**' | |
| - 'libs/cache/src/**' | |
| - 'libs/config/src/**' | |
| - 'libs/consumer/src/**' | |
| - 'libs/logger/src/**' | |
| - 'libs/openapi/src/**' | |
| - 'libs/queue/src/**' | |
| - 'libs/types/src/**' | |
| - 'libs/utils/src/**' | |
| account: | |
| - 'apps/account-api/**' | |
| - 'apps/account-worker/**' | |
| - 'libs/account-lib/**' | |
| graph: | |
| - 'apps/graph-api/**' | |
| - 'apps/graph-worker/**' | |
| - 'libs/graph-lib/**' | |
| content-publishing: | |
| - 'apps/content-publishing-api/**' | |
| - 'apps/content-publishing-worker/**' | |
| - 'libs/content-publishing-lib/**' | |
| - 'libs/storage/**' | |
| content-watcher: | |
| - 'apps/content-watcher/**' | |
| - 'libs/content-watcher-lib/**' | |
| - 'libs/storage/**' | |
| libs: | |
| - 'libs/blockchain/**' | |
| - 'libs/cache/src/**' | |
| - 'libs/config/src/**' | |
| - 'libs/consumer/src/**' | |
| - 'libs/logger/src/**' | |
| - 'libs/openapi/src/**' | |
| - 'libs/queue/src/**' | |
| - 'libs/storage/**' | |
| - 'libs/types/src/**' | |
| - 'libs/utils/src/**' | |
| test-start-sh: | |
| name: 'Common Tests' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache-dependency-path: ./package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: 'Bats start.sh Tests' | |
| run: | | |
| npm install -g bats | |
| npm run test:bats-start | |
| env: | |
| GITHUB_WORKSPACE: ${{ github.workspace }} | |
| - name: Lint | |
| run: npm run lint | |
| - name: Spellcheck | |
| run: npm run spellcheck | |
| - name: License Check | |
| # List all the licenses and error out if it is not one of the supported licenses | |
| run: npx license-report --fields=name --fields=licenseType | jq 'map(select(.licenseType | IN("MIT", "Apache-2.0", "ISC", "BSD", "BSD-3-Clause", "BSD-2-Clause", "(Apache-2.0 AND MIT)", "Apache-2.0 OR MIT") | not)) | if length == 0 then halt else halt_error(1) end' | |
| build: | |
| name: '[${{ matrix.service }}] Build and Test' | |
| runs-on: ubuntu-latest | |
| needs: service-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| service: ${{ fromJson(needs.service-matrix.outputs.services) }} | |
| # NOTE: The if statement has to be on each step. :( | |
| # This is because the job level if statement cannot handle matrix values | |
| steps: | |
| - name: Run or Skip | |
| id: should | |
| run: echo "RUN=${{ needs.service-matrix.outputs.run-all == 'true' || contains(fromJson(needs.service-matrix.outputs.changes), matrix.service) }}" >> "$GITHUB_OUTPUT" | |
| - name: Checkout | |
| if: ${{ steps.should.outputs.RUN == 'true' }} | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| if: ${{ steps.should.outputs.RUN == 'true' }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache-dependency-path: ./package-lock.json | |
| - name: Install dependencies | |
| if: ${{ steps.should.outputs.RUN == 'true' }} | |
| run: npm ci | |
| - name: Build NestJS | |
| if: ${{ steps.should.outputs.RUN == 'true' }} | |
| run: npm run build:${{ matrix.service }} | |
| - name: Unit Test | |
| if: ${{ steps.should.outputs.RUN == 'true' }} | |
| run: npm run test:${{ matrix.service }} | |
| - name: Build OpenAPI spec | |
| if: ${{ steps.should.outputs.RUN == 'true' && matrix.service != 'libs' }} | |
| uses: ./.github/workflows/common/openapi-build | |
| with: | |
| service: ${{ matrix.service }} | |
| # Test build of the Docker images | |
| - name: Set up QEMU | |
| if: ${{ steps.should.outputs.RUN == 'true' && matrix.service != 'libs' }} | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: | | |
| linux/amd64 | |
| - name: Set up Docker Buildx | |
| if: ${{ steps.should.outputs.RUN == 'true' && matrix.service != 'libs' }} | |
| uses: docker/setup-buildx-action@v3 | |
| # Use GitHub Container Registry instead due to rate limits | |
| with: | |
| buildkitd-config-inline: | | |
| [registry."ghcr.io"] | |
| - name: Check for DockerHub credentials | |
| id: docker-credentials | |
| if: ${{ steps.should.outputs.RUN == 'true' && matrix.service != 'libs' }} | |
| run: | | |
| if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" ] && [ -n "${{ secrets.DOCKERHUB_TOKEN }}" ]; then | |
| echo "do_dockerhub_login=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "do_dockerhub_login=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Login to DockerHub | |
| if: ${{ steps.should.outputs.RUN == 'true' && steps.docker-credentials.outputs.do_dockerhub_login == 'true' }} | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{secrets.DOCKERHUB_USERNAME}} | |
| password: ${{secrets.DOCKERHUB_TOKEN}} | |
| - name: Build Docker Image | |
| if: ${{ steps.should.outputs.RUN == 'true' && matrix.service != 'libs' }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: false | |
| file: Docker/Dockerfile.${{ matrix.service }} |