feat: initial import #5
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
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
extract_versions: | |
name: Extract info from .tool-versions | |
runs-on: ubuntu-latest | |
outputs: | |
elixir-version: ${{ steps.set-versions.outputs.elixir_version }} | |
otp-version: ${{ steps.set-versions.outputs.otp_version }} | |
steps: | |
- name: Checkout .tool-versions file | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.tool-versions | |
sparse-checkout-cone-mode: false | |
- name: Set Elixir, OTP, and Node.js versions as output | |
id: set-versions | |
run: | | |
elixir_version=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}') | |
otp_version=$(grep -h erlang .tool-versions | awk '{ print $2 }') | |
echo "elixir_version=$elixir_version" >> $GITHUB_OUTPUT | |
echo "otp_version=$otp_version" >> $GITHUB_OUTPUT | |
test: | |
name: Test on OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} | |
runs-on: ubuntu-latest | |
needs: extract_versions | |
env: | |
otp-version: ${{ needs.extract_versions.outputs.otp-version }} | |
elixir-version: ${{ needs.extract_versions.outputs.elixir-version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ env.otp-version }} | |
elixir-version: ${{ env.elixir-version }} | |
- name: Cache deps | |
id: cache-deps | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-elixir-deps | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-mix-${{ env.cache-name }}- | |
- name: Fetch dependencies | |
run: mix deps.get | |
- name: Check formatting | |
run: mix format --check-formatted | |
- name: Check for unused dependencies | |
run: mix deps.get && mix deps.unlock --check-unused | |
- name: Compile | |
run: mix compile --warnings-as-errors | |
- name: Test | |
run: mix test |