feat: add mix task for running tests under testcontainers #539
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Elixir CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build and test | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
pair: | |
- elixir: 1.16 | |
otp: 26.2 | |
- elixir: 1.15 | |
otp: 26.2 | |
- elixir: 1.14 | |
otp: 25.3 | |
- elixir: 1.13 | |
otp: 25.3 | |
- elixir: 1.13 | |
otp: 24.2 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.pair.elixir }} # [Required] Define the Elixir version | |
otp-version: ${{ matrix.pair.otp }} # [Required] Define the Erlang/OTP version | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Run tests | |
run: mix test --exclude flaky --cover | |
- name: Verify version | |
run: | | |
mix run -e "if(Testcontainers.Constants.library_version() == Mix.Project.config()[:version], do: IO.puts("OK"), else: System.halt(\"version mismatch\"))" | |
test_examples: | |
name: Test example projects | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0 | |
with: | |
elixir-version: '1.15.2' # [Required] Define the Elixir version | |
otp-version: '26.0' # [Required] Define the Erlang/OTP version | |
- name: Run example phoenix project tests | |
run: | | |
cd examples/phoenix_project | |
mix deps.get | |
mix test | |
MIX_ENV=prod mix release | |
- name: Run example mix project tests | |
run: | | |
cd examples/mix_project | |
mix deps.get | |
mix test |