|
1 | | -name: CI |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on: push |
4 | 4 |
|
5 | | -jobs: |
6 | | - lint: |
7 | | - runs-on: ubuntu-latest |
8 | | - name: Lint (OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}) |
9 | | - strategy: |
10 | | - matrix: |
11 | | - otp: ['26'] |
12 | | - elixir: ['1.15'] |
13 | | - steps: |
14 | | - - uses: actions/checkout@v3 |
15 | | - - uses: erlef/setup-beam@v1 |
16 | | - with: |
17 | | - otp-version: ${{matrix.otp}} |
18 | | - elixir-version: ${{matrix.elixir}} |
19 | | - - run: mix deps.get |
20 | | - - run: mix credo |
21 | | - - run: mix dialyzer |
22 | | - - run: mix format --check-formatted |
23 | | - - run: mix docs 2>&1 | (! grep -q "warning:") |
| 5 | +env: |
| 6 | + MIX_ENV: test |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
24 | 10 |
|
| 11 | +jobs: |
25 | 12 | test: |
26 | 13 | runs-on: ubuntu-latest |
27 | | - name: Test (OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}) |
| 14 | + name: CI on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} |
28 | 15 | strategy: |
29 | 16 | matrix: |
30 | 17 | otp: ['26'] |
31 | | - elixir: ['1.15'] |
32 | | - env: |
33 | | - MIX_ENV: test |
| 18 | + elixir: ['1.16'] |
34 | 19 | steps: |
35 | | - - uses: actions/checkout@v3 |
36 | | - - uses: erlef/setup-beam@v1 |
37 | | - with: |
38 | | - otp-version: ${{matrix.otp}} |
39 | | - elixir-version: ${{matrix.elixir}} |
40 | | - - run: mix deps.get |
41 | | - - run: mix coveralls.json |
42 | | - - uses: codecov/codecov-action@v3 |
| 20 | + - name: Set up Elixir |
| 21 | + uses: erlef/setup-beam@v1 |
| 22 | + with: |
| 23 | + otp-version: ${{matrix.otp}} |
| 24 | + elixir-version: ${{matrix.elixir}} |
| 25 | + |
| 26 | + - name: Checkout the code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Cache dependencies |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: deps |
| 33 | + key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-mix-deps- |
| 36 | +
|
| 37 | + - name: Cache compiled build |
| 38 | + uses: actions/cache@v4 |
| 39 | + with: |
| 40 | + path: _build |
| 41 | + key: ${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-mix-build- |
| 44 | + ${{ runner.os }}-mix- |
| 45 | +
|
| 46 | + - name: Cache dialyzer artifacts |
| 47 | + uses: actions/cache@v4 |
| 48 | + with: |
| 49 | + path: _dialyzer |
| 50 | + key: ${{ runner.os }}-dialyzer-${{ hashFiles('**/mix.lock') }} |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-dialyzer- |
| 53 | +
|
| 54 | + - name: Install dependencies |
| 55 | + run: mix deps.get |
| 56 | + |
| 57 | + - name: Compile without warnings |
| 58 | + id: compile |
| 59 | + run: mix compile --warnings-as-errors |
| 60 | + |
| 61 | + - name: Check formatting |
| 62 | + if: ${{ !cancelled() && steps.compile.outcome == 'success' }} |
| 63 | + run: mix format --check-formatted |
| 64 | + |
| 65 | + - name: Check with credo |
| 66 | + if: ${{ !cancelled() && steps.compile.outcome == 'success' }} |
| 67 | + run: mix credo |
| 68 | + |
| 69 | + - name: Check with dialyzer |
| 70 | + if: ${{ !cancelled() && steps.compile.outcome == 'success' }} |
| 71 | + run: mix dialyzer |
| 72 | + |
| 73 | + - name: Check docs |
| 74 | + if: ${{ !cancelled() && steps.compile.outcome == 'success' }} |
| 75 | + run: mix docs 2>&1 | (! grep -q "warning:") |
| 76 | + |
| 77 | + - name: Run tests and check test coverage |
| 78 | + if: ${{ !cancelled() && steps.compile.outcome == 'success' }} |
| 79 | + id: test |
| 80 | + run: mix coveralls.json |
| 81 | + |
| 82 | + - name: Upload test coverage results to Codecov |
| 83 | + if: ${{ !cancelled() && steps.test.outcome == 'success' }} |
| 84 | + uses: codecov/codecov-action@v4 |
| 85 | + with: |
| 86 | + fail_ci_if_error: true, |
| 87 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments