Skip to content

Commit

Permalink
Split integration & unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Argonus committed Apr 19, 2024
1 parent 1d4a92d commit dc1e559
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 1 deletion.
100 changes: 100 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI Integration

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
setup:
name: test | setup dependencies
runs-on: ubuntu-20.04
env:
MIX_ENV: test
strategy:
matrix:
pair:
- elixir: 1.16
otp: 26.1

steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- name: Setup elixir & erlang environment
uses: erlef/setup-beam@v1
with:
elixir-version: ${{matrix.pair.elixir}} # Define the elixir version [required]
otp-version: ${{matrix.pair.otp}} # Define the OTP version [required]

- name: Retrieve Mix Dependencies Cache
uses: actions/cache@v2
id: mix-cache # id to use in retrieve action
with:
path: deps
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Retrieve Mix Dependencies Compilation Cache
uses: actions/cache@v2
id: mix-deps-compile-cache # id to use in retrieve action
with:
path: _build
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Mix Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Compile Mix Dependencies
run: mix deps.compile

test:
name: runner / Test
needs: [setup]

runs-on: ubuntu-20.04
env:
MIX_ENV: test

strategy:
fail-fast: false
matrix:
pair:
- elixir: 1.16
otp: 26.1

steps:
- uses: actions/checkout@v2
- name: Setup elixir & erlang environment
uses: erlef/setup-beam@v1
with:
elixir-version: ${{matrix.pair.elixir}} # Define the elixir version [required]
otp-version: ${{matrix.pair.otp}} # Define the OTP version [required]

- name: Retrieve Mix Dependencies Cache
uses: actions/cache@v2
id: mix-cache # id to use in retrieve action
with:
path: deps
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Retrieve Mix Dependencies Compilation Cache
uses: actions/cache@v2
id: mix-deps-compile-cache # id to use in retrieve action
with:
path: _build
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Docker-compose up
run: ./scripts/docker_up.sh

- name: Docker ps
run: docker ps -a

- name: Run Tests
run: ./scripts/ci_tests.sh
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ jobs:
run: docker ps -a

- name: Run Tests
run: ./scripts/ci_tests.sh
run: mix test

0 comments on commit dc1e559

Please sign in to comment.