From bdf225bd654566a2fa8d057d6cf4b7528ca42ab2 Mon Sep 17 00:00:00 2001 From: Jason Axelson Date: Fri, 27 Nov 2020 23:08:39 -1000 Subject: [PATCH] Switch to github workflows (#420) * Switch to github workflows Travis open source version is going away at the end of the year. Also the wait times are an hour+ * Update versions of elixir/erlang tested --- .github/workflows/ci.yml | 89 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 49 ---------------------- 2 files changed, 89 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..0093b83f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,89 @@ +name: CI + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + mix_test: + name: mix test (Elixir ${{matrix.elixir}} | Erlang/OTP ${{matrix.otp}}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - elixir: 1.8.x + otp: 21.3.8.18 + tests_may_fail: false + - elixir: 1.9.x + otp: 21.3.8.18 + tests_may_fail: false + - elixir: 1.10.x + otp: 21.3.8.18 + tests_may_fail: false + check_unused_deps: true + - elixir: 1.11.x + otp: 21.3.8.18 + tests_may_fail: false + check_unused_deps: true + - elixir: 1.11.x + otp: 23.1.4 + tests_may_fail: false + warnings_as_errors: true + check_formatted: true + check_unused_deps: true + run_dialyzer: true + env: + MIX_ENV: test + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-elixir@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - name: Install Dependencies + run: | + mix local.hex --force + mix local.rebar --force + mix deps.get --only test + - run: mix format --check-formatted + if: matrix.check_formatted + - run: mix compile --warnings-as-errors + if: matrix.warnings_as_errors + - run: mix test || ${{ matrix.tests_may_fail }} + + static_analysis: + name: static analysis (Elixir ${{matrix.elixir}} | Erlang/OTP ${{matrix.otp}}) + runs-on: ubuntu-latest + strategy: + matrix: + include: + - elixir: 1.11.0 + otp: 23.1.1 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-elixir@v1 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - name: Cache build artifacts + uses: actions/cache@v2 + with: + path: | + ~/.hex + ~/.mix + _build + key: ${{ matrix.otp }}-${{ matrix.elixir }}-static_analysis-build + - name: Install Dependencies + run: | + mix local.hex --force + mix local.rebar --force + mix deps.get + - name: Restore timestamps to prevent unnecessary recompilation + run: IFS=$'\n'; for f in $(git ls-files); do touch -d "$(git log -n 1 --pretty='%cI' -- $f)" "$f"; done + - run: mix dialyzer + if: matrix.run_dialyzer diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 93de4168..00000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -language: elixir -script: - - MIX_ENV=test mix compile --force --warnings-as-errors - - | - if [[ "$CHECK_FORMATTED" -eq 1 ]] - then - mix format --check-formatted - else - echo "Not checking formatting" - fi - - mix test - - | - if [[ "$CHECK_UNUSED_DEPS" -eq 1 ]] - then - mix deps.unlock --check-unused - else - echo "Not checking unused deps" - fi - - | - if [[ "$RUN_DIALYZER" -eq 1 ]] - then - travis_wait 30 mix dialyzer - else - echo "Not running Dialyzer" - fi -env: - global: - - MIX_HOME=$HOME/.mix -cache: - directories: - - $HOME/.mix - - deps - - _build -matrix: - include: - - otp_release: 21.3 - elixir: 1.8.2 - - otp_release: 22.3 - elixir: 1.9.4 - - otp_release: 23.0.4 - elixir: 1.10.4 - env: - - CHECK_UNUSED_DEPS=1 - - otp_release: 23.0.4 - elixir: 1.11.1 - env: - - CHECK_FORMATTED=1 - - RUN_DIALYZER=1 - - CHECK_UNUSED_DEPS=1