1name: Tests 2 3on: 4 push: 5 pull_request: 6 branches: 7 - master 8 9jobs: 10 check_duplicate_runs: 11 name: Check for duplicate runs 12 continue-on-error: true 13 runs-on: ubuntu-latest 14 outputs: 15 should_skip: ${{ steps.skip_check.outputs.should_skip }} 16 steps: 17 - id: skip_check 18 uses: fkirc/skip-duplicate-actions@master 19 with: 20 concurrent_skipping: always 21 cancel_others: true 22 skip_after_successful_duplicate: true 23 paths_ignore: '["**/README.md", "**/CHANGELOG.md", "**/LICENSE.txt"]' 24 do_not_skip: '["pull_request"]' 25 26 tests: 27 name: Run tests (Elixir ${{matrix.elixir}}, OTP ${{matrix.otp}}) 28 29 needs: check_duplicate_runs 30 if: ${{ needs.check_duplicate_runs.outputs.should_skip != 'true' }} 31 32 strategy: 33 fail-fast: false 34 matrix: 35 elixir: 36 - "1.8.2" 37 - "1.10.4" 38 - "1.12.2" 39 otp: 40 - "22.3" 41 - "23.3" 42 - "24.0" 43 exclude: 44 - elixir: "1.8.2" 45 otp: "23.3" 46 - elixir: "1.8.2" 47 otp: "24.0" 48 - elixir: "1.12.2" 49 otp: "22.3" 50 51 runs-on: ubuntu-latest 52 53 steps: 54 - name: Checkout 55 uses: actions/checkout@v2 56 57 - name: Set up Elixir 58 uses: erlef/setup-elixir@v1 59 with: 60 elixir-version: ${{ matrix.elixir }} 61 otp-version: ${{ matrix.otp }} 62 63 - name: Restore deps and _build cache 64 uses: actions/cache@v2 65 with: 66 path: | 67 deps 68 _build 69 key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }} 70 restore-keys: | 71 deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} 72 deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}- 73 74 - name: Create dializer plts path 75 run: mkdir -p priv/plts 76 77 - name: Restore plts cache 78 uses: actions/cache@v2 79 with: 80 path: priv/plts 81 key: plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}-${{ github.sha }} 82 restore-keys: | 83 plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} 84 plts-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}- 85 86 - name: Install dependencies 87 run: mix deps.get --only test 88 89 - name: Check source code format 90 run: mix format --check-formatted 91 if: ${{ matrix.lint }} 92 93 - name: Perform source code static analysis 94 run: mix credo --strict 95 if: ${{ matrix.lint }} 96 env: 97 MIX_ENV: test 98 99 - name: Check unused dependencies 100 run: mix deps.unlock --check-unused 101 if: ${{ matrix.lint }} 102 103 - name: Remove compiled application files 104 run: mix clean 105 106 - name: Compile dependencies 107 run: mix compile 108 if: ${{ !matrix.lint }} 109 env: 110 MIX_ENV: test 111 112 - name: Compile & lint dependencies 113 run: mix compile --warnings-as-errors 114 if: ${{ matrix.lint }} 115 env: 116 MIX_ENV: test 117 118 - name: Run tests 119 run: mix coveralls.github 120 env: 121 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 122 123 - name: Run dialyzer 124 run: mix dialyzer 125 env: 126 MIX_ENV: test 127 128 all_done: 129 name: Tests done 130 needs: tests 131 132 runs-on: ubuntu-latest 133 134 steps: 135 - name: All done 136 run: echo '+' 137