ci(github): add a coverage job uploading to Codecov #108
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| - release/* | |
| - feature/* | |
| - bugfix/* | |
| - hotfix/* | |
| - docs/* | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| types: | |
| - opened | |
| - edited | |
| - reopened | |
| - synchronize | |
| - ready_for_review | |
| env: | |
| CLICOLOR_FORCE: 1 | |
| IS_PULL_REQUEST: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| commits: | |
| name: Conventional Commits | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone the repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| - name: Setup the Nix cache | |
| uses: DeterminateSystems/magic-nix-cache-action@main | |
| - name: Setup the environment | |
| run: nix build -L --no-link .#devShells.x86_64-linux.ci-committed | |
| - name: Run the commit linter | |
| run: nix develop .#ci-committed -c elixir scripts/check_commits.exs | |
| format: | |
| name: Code formatting and typos | |
| runs-on: ubuntu-latest | |
| env: | |
| CI_JOB: format | |
| MIX_ENV: format | |
| steps: | |
| - name: Clone the repository | |
| uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| - name: Setup the Nix cache | |
| uses: DeterminateSystems/magic-nix-cache-action@main | |
| - name: Setup the environment | |
| run: nix build -L --no-link .#devShells.x86_64-linux.ci-formatters | |
| - name: Install Hex | |
| run: nix develop .#ci-formatters -c mix local.hex --force | |
| - name: Fetch the dependencies | |
| run: nix develop .#ci-formatters -c mix deps.get | |
| - name: Build the dependencies | |
| run: nix develop .#ci-formatters -c mix deps.compile | |
| - name: Check the code is formatted and free of typos | |
| run: nix develop .#ci-formatters -c mix check | |
| checks: | |
| name: Code checks (Elixir ${{matrix.elixir}} on OTP ${{matrix.otp}}) | |
| runs-on: ubuntu-latest | |
| env: | |
| CI_JOB: checks | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Update rule: | |
| # - latest Elixir on all supported OTP versions, | |
| # - previous Elixir on the last two supported OTP versions, | |
| # - oldest Elixir on the first and last supported OTP versions, | |
| # - other Elixir version on the first supported OTP version. | |
| - elixir: "1.19" | |
| otp: "28.1" | |
| - elixir: "1.19" | |
| otp: "27.3" | |
| - elixir: "1.19" | |
| otp: "26.2" | |
| - elixir: "1.18" | |
| otp: "27.3" | |
| - elixir: "1.18" | |
| otp: "26.2" | |
| - elixir: "1.17" | |
| otp: "25.3" | |
| - elixir: "1.16" | |
| otp: "24.3" | |
| - elixir: "1.15" | |
| otp: "26.2" | |
| - elixir: "1.15" | |
| otp: "24.3" | |
| steps: | |
| - name: Clone the repository | |
| uses: actions/checkout@v4 | |
| - name: Install Elixir/OTP | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{matrix.otp}} | |
| elixir-version: ${{matrix.elixir}} | |
| - name: Fetch the dependencies | |
| run: mix deps.get | |
| - name: Build the dependencies | |
| run: mix deps.compile | |
| - name: Run the checks | |
| run: mix check | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| env: | |
| MIX_ENV: test | |
| steps: | |
| - name: Clone the repository | |
| uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| - name: Setup the Nix cache | |
| uses: DeterminateSystems/magic-nix-cache-action@main | |
| - name: Setup the environment | |
| run: nix build -L --no-link .#devShells.x86_64-linux.ci-minimal | |
| - name: Fetch the dependencies | |
| run: nix develop .#ci-minimal -c mix deps.get | |
| - name: Build the dependencies | |
| run: nix develop .#ci-minimal -c mix deps.compile | |
| - name: Generate the test coverage report | |
| run: nix develop .#ci-minimal -c mix coveralls.lcov | |
| - name: Upload the test coverage report | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| disable_search: true | |
| files: ./cover/lcov.info | |
| fail_ci_if_error: true | |
| use_oidc: true | |
| docs: | |
| name: Documentation | |
| runs-on: ubuntu-latest | |
| env: | |
| MIX_ENV: docs | |
| steps: | |
| - name: Clone the repository | |
| uses: actions/checkout@v4 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| - name: Setup the Nix cache | |
| uses: DeterminateSystems/magic-nix-cache-action@main | |
| - name: Setup the environment | |
| run: nix build -L --no-link .#devShells.x86_64-linux.ci-minimal | |
| - name: Install Hex | |
| run: nix develop .#ci-minimal -c mix local.hex --force | |
| - name: Fetch the dependencies | |
| run: nix develop .#ci-minimal -c mix deps.get | |
| - name: Build the dependencies | |
| run: nix develop .#ci-minimal -c mix deps.compile | |
| - name: Check the documentation | |
| run: nix develop .#ci-minimal -c mix docs |