-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch moves CI checks into GitHub actions and away from CircleCI. Hooray.
- Loading branch information
Showing
4 changed files
with
104 additions
and
0 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,45 @@ | ||
name: Elixir CI | ||
|
||
on: | ||
push: | ||
|
||
# Sets the ENV `MIX_ENV` to `test` for running tests | ||
env: | ||
MIX_ENV: test | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
name: "Elixir Lint" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Compile with cache | ||
uses: ./.github/workflows/setup-elixir | ||
|
||
# If this complains about redefining modules as a warning, | ||
# there can be a probem with the cached build, so switch to giving | ||
# a cache key modifier input on the setup elixir action (e.g. key <> "lint" ) | ||
- name: Compiles without warnings | ||
run: mix compile --warnings-as-errors | ||
|
||
- name: Check Formatting | ||
run: mix format --check-formatted | ||
|
||
test-and-coverage: | ||
permissions: write-all | ||
name: "Elixir Tests" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Compile with cache | ||
uses: ./.github/workflows/setup-elixir | ||
|
||
- name: Run Elixir Tests | ||
run: mix test --formatter JUnitFormatter --formatter ExUnit.CLIFormatter |
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,57 @@ | ||
name: Set up Elixir with cached build | ||
description: "pulls in the elixir dependencies and builds a cache for the compiled build" | ||
inputs: | ||
mix_env: | ||
description: "MIX_ENV to compile" | ||
required: true | ||
default: "test" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Step: Setup Elixir + Erlang image as the base. | ||
- name: Set up Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: "26.1.2" | ||
elixir-version: "1.15" | ||
|
||
# Step: Define how to cache deps. Restores existing cache if present. | ||
- name: Cache deps | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-elixir-deps | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ inputs.mix_env }}-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-mix-${{ inputs.mix_env }}-${{ env.cache-name }}- | ||
# Step: Define how to cache the `_build` directory. After the first run, | ||
# this speeds up tests runs a lot. This includes not re-compiling our | ||
# project's downloaded deps every run. | ||
- name: Cache compiled build | ||
id: cache-build | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-compiled-build | ||
with: | ||
path: _build | ||
key: ${{ runner.os }}-mix-${{ inputs.mix_env }}-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-mix-${{ inputs.mix_env }}-${{ env.cache-name }}- | ||
${{ runner.os }}-mix-${{ inputs.mix_env }}- | ||
# Step: Download project dependencies. If unchanged, uses | ||
# the cached version. | ||
- name: Install dependencies | ||
shell: bash | ||
run: mix deps.get | ||
|
||
# Step: Compile the project for test and cache the build | ||
- name: Build for cache | ||
shell: bash | ||
run: mix compile | ||
env: | ||
MIX_ENV: ${{ inputs.mix_env }} |
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