fix: improve inspector usability #2818
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: Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - "lib/**" | |
| - "test/**" | |
| - "config/**" | |
| - "priv/**" | |
| - "!priv/repo/tenant_db_catalog_*.json" | |
| - "assets/**" | |
| - "rel/**" | |
| - "native/**" | |
| - "dev/**" | |
| - "mix.exs" | |
| - "compose.dbs.yml" | |
| - "mix.lock" | |
| - "Dockerfile" | |
| - "run.sh" | |
| - ".github/workflows/tests.yml" | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| MIX_ENV: test | |
| jobs: | |
| tests: | |
| name: Tests (${{ matrix.postgres }} - Partition ${{ matrix.partition }}) | |
| runs-on: blacksmith-8vcpu-ubuntu-2404 | |
| env: | |
| POSTGRES_IMAGE: ${{ matrix.postgres_image }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| partition: [1, 2, 3, 4] | |
| postgres: [pg14, pg15, pg15_latest, pg17, orioledb17] | |
| include: | |
| - postgres: pg14 | |
| postgres_image: supabase/postgres:14.1.0.82 | |
| # test before supautils.policy_grants added all necessary grants | |
| - postgres: pg15 | |
| postgres_image: supabase/postgres:15.1.0.1 | |
| - postgres: pg15_latest | |
| postgres_image: supabase/postgres:15.14.1.129 | |
| - postgres: pg17 | |
| postgres_image: supabase/postgres:17.6.1.127 | |
| - postgres: orioledb17 | |
| postgres_image: supabase/postgres:17.6.0.096-orioledb | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup elixir | |
| id: beam | |
| uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0 | |
| with: | |
| otp-version: 28.5.0.4 # Define the OTP version [required] | |
| elixir-version: 1.19.5 # Define the elixir version [required] | |
| - name: Cache Mix | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| priv/native | |
| key: ${{ github.workflow }}-${{ runner.os }}-mix-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| ${{ github.workflow }}-${{ runner.os }}-mix-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}- | |
| - name: Cache Docker images | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| id: docker-cache | |
| with: | |
| path: /tmp/docker-images | |
| key: docker-images-zstd-${{ env.POSTGRES_IMAGE }} | |
| - name: Load Docker images from cache | |
| if: steps.docker-cache.outputs.cache-hit == 'true' | |
| run: zstd -d --stdout /tmp/docker-images/postgres.tar.zst | docker image load | |
| - name: Pull and save Docker images | |
| if: steps.docker-cache.outputs.cache-hit != 'true' | |
| run: | | |
| docker pull ${{ env.POSTGRES_IMAGE }} | |
| mkdir -p /tmp/docker-images | |
| docker image save ${{ env.POSTGRES_IMAGE }} | zstd -T0 -o /tmp/docker-images/postgres.tar.zst | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Set up Postgres | |
| run: docker compose -f compose.dbs.yml up -d --wait | |
| - name: Start epmd | |
| run: epmd -daemon | |
| - name: Run tests | |
| run: MIX_TEST_PARTITION=${{ matrix.partition }} mix coveralls.lcov --partitions 4 --export-coverage partition-${{ matrix.partition }} | |
| - name: Upload coverage artifact | |
| if: matrix.postgres == 'pg17' | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: coverage-partition-${{ matrix.partition }} | |
| path: | | |
| cover/lcov.info | |
| cover/partition-${{ matrix.partition }}.coverdata | |
| coverage: | |
| name: Merge Coverage | |
| needs: tests | |
| if: ${{ needs.tests.result == 'success' }} | |
| runs-on: blacksmith-8vcpu-ubuntu-2404 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Download all coverage artifacts | |
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
| with: | |
| pattern: coverage-partition-* | |
| path: coverage | |
| - name: Upload merged coverage to Coveralls | |
| uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| files: coverage/coverage-partition-1/lcov.info coverage/coverage-partition-2/lcov.info coverage/coverage-partition-3/lcov.info coverage/coverage-partition-4/lcov.info | |
| crap: | |
| name: CRAP Report | |
| needs: tests | |
| if: ${{ github.event_name == 'pull_request' && needs.tests.result == 'success' }} | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup elixir | |
| id: beam | |
| uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0 | |
| with: | |
| otp-version: 28.5.0.4 | |
| elixir-version: 1.19.5 | |
| - name: Cache Mix | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: | | |
| deps | |
| _build | |
| priv/native | |
| key: ${{ github.workflow }}-${{ runner.os }}-mix-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: | | |
| ${{ github.workflow }}-${{ runner.os }}-mix-${{ steps.beam.outputs.elixir-version }}-${{ steps.beam.outputs.otp-version }}- | |
| - name: Install dependencies | |
| run: mix deps.get | |
| - name: Download coverage artifacts | |
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
| with: | |
| pattern: coverage-partition-* | |
| path: coverage | |
| - name: Build CRAP report | |
| run: | | |
| mix compile | |
| { | |
| echo '## CRAP Score Report' | |
| echo '```' | |
| mix crap.ci 2>&1 | | |
| sed -r 's/\x1b\[[0-9;]*m//g' | | |
| sed -n '/^Summary:/,$p' || | |
| true | |
| echo '```' | |
| } > crap-report.md | |
| - name: Post CRAP report comment | |
| continue-on-error: true | |
| uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4 | |
| with: | |
| header: crap-report | |
| path: crap-report.md |