Skip to content

Commit

Permalink
Set up GitHub CI
Browse files Browse the repository at this point in the history
  • Loading branch information
angelikatyborska committed Jan 20, 2024
1 parent 8385edd commit f5245ee
Showing 1 changed file with 89 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: test

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.older }}
strategy:
fail-fast: true
matrix:
include:
- elixir: '1.11.0'
otp: '23.2'
older: true
- elixir: '1.12.0'
otp: '24.0'
older: true
- elixir: '1.13.0'
otp: '24.1'
older: true
- elixir: '1.14.0'
otp: '25.0'
older: true
- elixir: '1.15.0'
otp: '26.0'
older: true
- elixir: '1.16.0'
otp: '26.2'

steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Use Elixir
uses: erlef/setup-beam@a34c98fd51e370b4d4981854aba1eb817ce4e483
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Set cache key
id: set_cache_key
run: |
erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell > ERLANG_VERSION
cat ERLANG_VERSION
elixir --version | tail -n 1 > ELIXIR_VERSION
cat ELIXIR_VERSION
cache_key="os-${{ runner.os }}-erlang-$( sha256sum ERLANG_VERSION | cut -d ' ' -f 1 )-elixir-$( sha256sum ELIXIR_VERSION | cut -d ' ' -f 1 )-mix-lock-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}"
echo "::set-output name=cache_key::$cache_key"
- name: Retrieve Mix Dependencies Cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c
id: mix-cache # id to use in retrieve action
with:
path: deps
key: mix-${{ steps.set_cache_key.outputs.cache_key }}-v1

- name: Install Mix Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: mix deps.get

- name: Build Project
run: mix

- name: Retrieve PLT Cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c
id: plt-cache
with:
path: priv/plts
key: plts-${{ steps.set_cache_key.outputs.cache_key }}-v1

- name: Create PLTs
if: steps.plt-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix dialyzer --plt
- name: Run tests
run: mix test

- name: Run Dialyzer
run: mix dialyzer

- name: Run format check
run: mix format --check-formatted

0 comments on commit f5245ee

Please sign in to comment.