-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split CI tasks related to Elixir to improve build times by parallelizing different steps.
- Loading branch information
Showing
8 changed files
with
259 additions
and
79 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
~r(test/support/[^.]*\.ex) | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
name: Elixir tests | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }} | ||
LANG: C.UTF-8 | ||
LC_ALL: C.UTF-8 | ||
MIX_ENV: test | ||
|
||
jobs: | ||
deps: | ||
name: Fetch deps | ||
runs-on: u22-arm-runner | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: '25.3.2.7' | ||
elixir-version: '1.14.5' | ||
- name: Cache Mix | ||
uses: actions/cache@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
restore-keys: | | ||
${{ runner.os }}-mix- | ||
- name: Install dependencies | ||
run: mix deps.get | ||
|
||
compile: | ||
name: Compile project in test env | ||
runs-on: u22-arm-runner | ||
needs: [deps] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: '25.3.2.7' | ||
elixir-version: '1.14.5' | ||
- name: Cache Mix | ||
uses: actions/cache@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
restore-keys: | | ||
${{ runner.os }}-mix- | ||
- name: Cache Build | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
_build/${{ env.MIX_ENV }} | ||
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.MIX_ENV }}- | ||
- name: Cache native | ||
uses: actions/cache@v4 | ||
id: native-cache | ||
with: | ||
path: | | ||
priv/native | ||
key: ${{ runner.os }}-build-native-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/native/**/*')) }} | ||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@v1 | ||
if: steps.native-cache.outputs.cache-hit != 'true' || steps.elixir-cache.output.cache-hit != 'true' | ||
with: | ||
toolchain: stable | ||
- name: Compile | ||
run: mix compile | ||
|
||
format: | ||
name: Formatting checks | ||
runs-on: u22-arm-runner | ||
needs: [deps] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: '25.3.2.7' | ||
elixir-version: '1.17' | ||
- name: Cache Mix | ||
uses: actions/cache@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
restore-keys: | | ||
${{ runner.os }}-mix- | ||
- name: Run format check | ||
run: mix format --check-formatted | ||
|
||
credo: | ||
name: Code style | ||
runs-on: u22-arm-runner | ||
needs: [compile] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: '25.3.2.7' | ||
elixir-version: '1.14.5' | ||
- name: Cache Mix | ||
uses: actions/cache@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
restore-keys: | | ||
${{ runner.os }}-mix- | ||
- name: Cache Build | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
_build/${{ env.MIX_ENV }} | ||
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.MIX_ENV }}- | ||
- name: Credo checks | ||
run: mix credo --strict --mute-exit-status | ||
|
||
tests: | ||
name: Run tests | ||
runs-on: u22-arm-runner | ||
needs: [compile] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: '25.3.2.7' | ||
elixir-version: '1.14.5' | ||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@v1 | ||
if: steps.native-cache.outputs.cache-hit != 'true' || steps.elixir-cache.output.cache-hit != 'true' | ||
with: | ||
toolchain: stable | ||
- name: Cache Mix | ||
uses: actions/cache@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
restore-keys: | | ||
${{ runner.os }}-mix- | ||
- name: Cache Build | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
_build/${{ env.MIX_ENV }} | ||
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.MIX_ENV }}- | ||
- name: Cache native | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
priv/native | ||
key: ${{ runner.os }}-build-native-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/native/**/*')) }} | ||
- name: Set up Postgres | ||
run: docker-compose -f ./docker-compose.db.yml up -d | ||
- name: Start epmd | ||
run: epmd -daemon | ||
- name: Run tests | ||
run: mix test | ||
|
||
dialyzer: | ||
name: Dialyze | ||
runs-on: u22-arm-runner | ||
needs: [compile] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Elixir | ||
id: beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: '25.3.2.7' | ||
elixir-version: '1.14.5' | ||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@v1 | ||
if: steps.native-cache.outputs.cache-hit != 'true' || steps.elixir-cache.output.cache-hit != 'true' | ||
with: | ||
toolchain: stable | ||
- name: Cache Mix | ||
uses: actions/cache@v4 | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
restore-keys: | | ||
${{ runner.os }}-mix- | ||
- name: Cache Build | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
_build/${{ env.MIX_ENV }} | ||
key: ${{ runner.os }}-build-${{ env.MIX_ENV }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.MIX_ENV }}- | ||
- name: Cache native | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
priv/native | ||
key: ${{ runner.os }}-build-native-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/native/**/*')) }} | ||
- name: Retrieve PLT Cache | ||
uses: actions/cache@v4 | ||
id: plt-cache | ||
with: | ||
path: _build/${{ env.MIX_ENV }}/*.plt | ||
key: ${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | ||
- name: Create PLTs | ||
if: steps.plt-cache.outputs.cache-hit != 'true' | ||
run: | | ||
mkdir -p priv/plts | ||
mix dialyzer.build | ||
- name: Run dialyzer | ||
run: mix dialyzer |
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 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 file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.1.66 | ||
1.1.67 |
Oops, something went wrong.