|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +jobs: |
| 12 | + mix_test: |
| 13 | + name: mix test (Elixir ${{matrix.elixir}} | Erlang/OTP ${{matrix.otp}}) |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - elixir: 1.8.x |
| 20 | + otp: 21.3.8.18 |
| 21 | + tests_may_fail: false |
| 22 | + - elixir: 1.9.x |
| 23 | + otp: 21.3.8.18 |
| 24 | + tests_may_fail: false |
| 25 | + - elixir: 1.10.x |
| 26 | + otp: 21.3.8.18 |
| 27 | + tests_may_fail: false |
| 28 | + check_unused_deps: true |
| 29 | + - elixir: 1.11.x |
| 30 | + otp: 21.3.8.18 |
| 31 | + tests_may_fail: false |
| 32 | + check_unused_deps: true |
| 33 | + - elixir: 1.11.x |
| 34 | + otp: 23.1.4 |
| 35 | + tests_may_fail: false |
| 36 | + warnings_as_errors: true |
| 37 | + check_formatted: true |
| 38 | + check_unused_deps: true |
| 39 | + run_dialyzer: true |
| 40 | + env: |
| 41 | + MIX_ENV: test |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v2 |
| 44 | + - uses: actions/setup-elixir@v1 |
| 45 | + with: |
| 46 | + otp-version: ${{matrix.otp}} |
| 47 | + elixir-version: ${{matrix.elixir}} |
| 48 | + - name: Install Dependencies |
| 49 | + run: | |
| 50 | + mix local.hex --force |
| 51 | + mix local.rebar --force |
| 52 | + mix deps.get --only test |
| 53 | + - run: mix format --check-formatted |
| 54 | + if: matrix.check_formatted |
| 55 | + - run: mix compile --warnings-as-errors |
| 56 | + if: matrix.warnings_as_errors |
| 57 | + - run: mix test || ${{ matrix.tests_may_fail }} |
| 58 | + |
| 59 | + static_analysis: |
| 60 | + name: static analysis (Elixir ${{matrix.elixir}} | Erlang/OTP ${{matrix.otp}}) |
| 61 | + runs-on: ubuntu-latest |
| 62 | + strategy: |
| 63 | + matrix: |
| 64 | + include: |
| 65 | + - elixir: 1.11.0 |
| 66 | + otp: 23.1.1 |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v2 |
| 69 | + - uses: actions/setup-elixir@v1 |
| 70 | + with: |
| 71 | + otp-version: ${{matrix.otp}} |
| 72 | + elixir-version: ${{matrix.elixir}} |
| 73 | + - name: Cache build artifacts |
| 74 | + uses: actions/cache@v2 |
| 75 | + with: |
| 76 | + path: | |
| 77 | + ~/.hex |
| 78 | + ~/.mix |
| 79 | + _build |
| 80 | + key: ${{ matrix.otp }}-${{ matrix.elixir }}-static_analysis-build |
| 81 | + - name: Install Dependencies |
| 82 | + run: | |
| 83 | + mix local.hex --force |
| 84 | + mix local.rebar --force |
| 85 | + mix deps.get |
| 86 | + - name: Restore timestamps to prevent unnecessary recompilation |
| 87 | + run: IFS=$'\n'; for f in $(git ls-files); do touch -d "$(git log -n 1 --pretty='%cI' -- $f)" "$f"; done |
| 88 | + - run: mix dialyzer |
| 89 | + if: matrix.run_dialyzer |
0 commit comments