Improve doc #64
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: | |
- main | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- elixir: "1.17.0" | |
otp: "27.0" | |
lint: true | |
- elixir: "1.16.2" | |
otp: "26.1" | |
lint: true | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{matrix.otp}} | |
elixir-version: ${{matrix.elixir}} | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
artifacts/deps | |
artifacts/build | |
key: ${{ runner.os }}-mix-${{matrix.elixir}}-${{matrix.otp}}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Configure environment | |
run: | | |
git config --global user.email "github-actions@noreply.github.com" | |
git config --global user.name "github-actions" | |
git config --global init.defaultBranch "main" | |
- name: Get root dependencies | |
run: mix deps.get | |
- name: Workspace checks | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.check | |
if: ${{ matrix.lint }} | |
- name: Set environment variables | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "MODIFIED_ARGS=--modified --base origin/main" >> $GITHUB_ENV | |
echo "AFFECTED_ARGS=--affected --base origin/main" >> $GITHUB_ENV | |
else | |
echo "MODIFIED_ARGS=" >> $GITHUB_ENV | |
echo "AFFECTED_ARGS=" >> $GITHUB_ENV | |
fi | |
- name: Get workspace dependencies | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.run -t deps.get ${{env.AFFECTED_ARGS}} | |
- name: Compile dependencies | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.run -t deps.compile ${{env.AFFECTED_ARGS}} -- --skip-local-deps | |
- name: Compile with warnings enabled | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.run -t compile ${{env.AFFECTED_ARGS}} -- --force --warnings-as-errors | |
- name: Check code formatted | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.run -t format ${{env.MODIFIED_ARGS}} -- --check-formatted | |
if: ${{ matrix.lint }} | |
- name: Tests | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.run -t test ${{env.AFFECTED_ARGS}} -- --cover --warnings-as-errors | |
- name: Coverage | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.test.coverage ${{env.AFFECTED_ARGS}} | |
- name: Check docs | |
run: | | |
shopt -s expand_aliases | |
alias mix='elixir --erl "-elixir ansi_enabled true" -S mix' | |
mix workspace.run -t docs ${{env.MODIFIED_ARGS}} -- -f html | |
if: ${{ matrix.lint }} |