Add code quality jobs to CI workflow #247
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: Elixir CI | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| name: mix test (OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| otp: [25.x, 26.x, 27.x, 28.x] | |
| elixir: [1.18.x] | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install CA certificates | |
| run: sudo apt-get update && sudo apt-get install -y ca-certificates | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{matrix.otp}} | |
| elixir-version: ${{matrix.elixir}} | |
| - name: Cache Mix Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.mix | |
| _build | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: ${{ runner.os }}-mix- | |
| - name: Install Dependencies | |
| run: | | |
| mix local.rebar --force | |
| mix local.hex --force | |
| mix deps.get | |
| mix deps.compile | |
| - name: Compile | |
| run: mix compile --warnings-as-errors | |
| - name: Run Tests | |
| run: mix test --trace | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: 1.18.x | |
| otp-version: 26.x | |
| - name: Cache Mix Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.mix | |
| _build | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: ${{ runner.os }}-mix- | |
| - name: Install Dependencies | |
| run: | | |
| mix local.rebar --force | |
| mix local.hex --force | |
| mix deps.get | |
| mix deps.compile | |
| - name: Check Format | |
| run: mix format --check-formatted --dry-run | |
| credo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: 1.18.x | |
| otp-version: 26.x | |
| - name: Cache Mix Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.mix | |
| _build | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: ${{ runner.os }}-mix- | |
| - name: Install Dependencies | |
| run: | | |
| mix local.rebar --force | |
| mix local.hex --force | |
| mix deps.get | |
| mix deps.compile | |
| - name: Run Credo | |
| run: mix credo --strict --format sarif --output credo-results.sarif | |
| - name: Upload Credo results | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: credo-results.sarif | |
| wait-for-processing: true | |
| unused-deps: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: 1.18.x | |
| otp-version: 26.x | |
| - name: Cache Mix Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.mix | |
| _build | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: ${{ runner.os }}-mix- | |
| - name: Install Dependencies | |
| run: | | |
| mix local.rebar --force | |
| mix local.hex --force | |
| mix deps.get | |
| mix deps.compile | |
| - name: Check for unused dependencies | |
| run: mix deps.unlock --check-unused | |
| dialyzer: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| elixir-version: 1.18.x | |
| otp-version: 26.x | |
| - name: Cache Mix Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.mix | |
| _build | |
| key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
| restore-keys: ${{ runner.os }}-mix- | |
| - name: Install Dependencies | |
| run: | | |
| mix local.rebar --force | |
| mix local.hex --force | |
| mix deps.get | |
| mix deps.compile | |
| - name: Run Dialyzer | |
| run: mix dialyzer |