fix: issue on saving plt #1
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 | ||
# CI | ||
name: Reusable Elixir CI | ||
on: | ||
workflow_call: | ||
inputs: | ||
working-directory: | ||
required: true | ||
type: string | ||
os: | ||
required: true | ||
type: string | ||
matrix: | ||
required: true | ||
type: string | ||
perform-check: | ||
required: true | ||
type: boolean | ||
env: | ||
XLA_HTTP_HEADERS: "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | ||
jobs: | ||
elixir_ci: | ||
name: On ${{ matrix.elixir-version }}, ${{ matrix.otp-version }} | ||
runs-on: ${{ inputs.os }} | ||
strategy: | ||
matrix: ${{ fromJSON(inputs.matrix) }} | ||
defaults: | ||
run: | ||
working-directory: ${{ inputs.working-directory }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: kenchan0130/actions-system-info@master | ||
id: system-info | ||
- name: Set up OTP MAJOR and MINOR VERSION | ||
run: | | ||
echo "OTP_MAJOR_VERSION=$(echo ${{ matrix.otp-version }} | sed -e 's/^\([^\.]*\)\.\(.*\)$/\1/')" >> $GITHUB_ENV | ||
echo "OTP_MINOR_VERSION=$(echo ${{ matrix.otp-version }} | sed -e 's/^\([^\.]*\)\.\([^\.]*\).*$/\2/')" >> $GITHUB_ENV | ||
- name: Set versions Elixir and OTP | ||
run: | | ||
echo "erlang ${{ matrix.otp-version }}" >> ${{ github.workspace }}/.tool-versions | ||
echo "elixir ${{ matrix.elixir-version }}-otp-${{ env.OTP_MAJOR_VERSION }}" >> ${{ github.workspace }}/.tool-versions | ||
- name: Set up Elixir | ||
continue-on-error: true | ||
id: set_up_elixir_by_setup-beam | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{ matrix.elixir-version }} | ||
otp-version: ${{ matrix.otp-version }} | ||
- name: Install asdf | ||
continue-on-error: true | ||
if: ${{ steps.set_up_elixir_by_setup-beam.outcome == 'failure' }} | ||
id: install_asdf | ||
uses: asdf-vm/actions/setup@v3 | ||
- name: Restore .asdf | ||
if: ${{ steps.install_asdf.outcome == 'success' }} | ||
id: asdf-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.asdf/ | ||
key: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}-asdf-${{ hashFiles('**/.tool-versions') }} | ||
restore-keys: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}-asdf- | ||
- name: Set up Elixir by asdf (Ubuntu) | ||
id: install_by_asdf | ||
continue-on-error: true | ||
if: ${{ steps.set_up_elixir_by_setup-beam.outcome == 'failure' }} | ||
uses: asdf-vm/actions/install@v3 | ||
with: | ||
before_install: | | ||
sudo apt -y install build-essential automake autoconf git squashfs-tools ssh-askpass pkg-config curl libmnl-dev | ||
- name: Recover if fail | ||
if: steps.install_by_asdf.outcome == 'failure' | ||
run: | | ||
echo "erlang ${{ matrix.otp-version }}" > ${{ github.workspace }}/.tool-versions | ||
echo "elixir ${{ matrix.elixir-version }}-otp-$((${{ env.OTP_MAJOR_VERSION }}-1))" > ${{ github.workspace }}/.tool-versions | ||
- name: Set up Elixir by asdf, again (Ubuntu) | ||
if: steps.install_by_asdf.outcome == 'failure' | ||
uses: asdf-vm/actions/install@v3 | ||
with: | ||
before_install: | | ||
sudo apt -y install build-essential automake autoconf git squashfs-tools ssh-askpass pkg-config curl libmnl-dev | ||
- name: Restore dependencies cache | ||
uses: actions/cache@v4 | ||
id: dependencies-cache | ||
with: | ||
path: ${{ github.workspace }}/${{ inputs.working-directory }}/deps | ||
key: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}- | ||
- name: Set up hex and rebar | ||
run: | | ||
mix local.hex --force | ||
mix local.rebar --force | ||
- name: Install dependencies | ||
run: mix deps.get | ||
- name: Compile and check warning | ||
if: ${{ inputs.perform-check }} | ||
run: mix compile --warnings-as-errors | ||
- name: Check formatting (Ubuntu, macOS) | ||
if: ${{ inputs.perform-check && !startsWith(runner.os, 'windows') && startsWith(matrix.elixir-version, '1.15') && startsWith(matrix.otp-version, '26') }} | ||
run: mix format --check-formatted | ||
- name: Check by credo (Ubuntu) | ||
if: ${{ inputs.perform-check && startsWith(runner.os, 'linux') }} | ||
run: mix credo | ||
- name: Restore PLT cache | ||
id: plt_cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
key: | | ||
plt-${{ runner.os }}-${{ steps.system-info.outputs.release }}-${{ matrix.otp-version }}-${{ matrix.elixir-version }}-${{ inputs.working-directory }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
plt-${{ runner.os }}-${{ steps.system-info.outputs.release }}-${{ matrix.otp-version }}-${{ matrix.elixir-version }}-${{ inputs.working-directory }}- | ||
path: | | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
${{ github.workspace }}/${{ inputs.working-directory }}/_build/test/dialyxir_erlang-${{ matrix.otp-version }}_elixir-${{ matrix.elixir-version }}_deps-test.plt | ||
======= | ||
${{ github.workspace }}/${{ inputs.working-directory }}/priv/plts | ||
>>>>>>> 0037a87 (fix: issue on saving plt) | ||
======= | ||
${{ github.workspace }}/${{ inputs.working-directory }}/_build/test/dialyxir_erlang-${{ matrix.otp-version }}_elixir-${{ matrix.elixir-version }}_deps-test.plt | ||
>>>>>>> 0d90e76 (fix: issue on saving plt) | ||
- name: Create PLTs | ||
if: steps.plt_cache.outputs.cache-hit != 'true' && ${{ inputs.perform-check && startsWith(runner.os, 'linux') }} | ||
run: mix dialyzer --plt | ||
- name: Save PLT cache | ||
id: plt_cache_save | ||
uses: actions/cache/save@v4 | ||
if: steps.plt_cache.outputs.cache-hit != 'true' && ${{ inputs.perform-check && startsWith(runner.os, 'linux') }} | ||
with: | ||
key: | | ||
plt-${{ runner.os }}-${{ steps.system-info.outputs.release }}-${{ matrix.otp-version }}-${{ matrix.elixir-version }}-${{ inputs.working-directory }}-${{ hashFiles('**/mix.lock') }} | ||
path: | | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
${{ github.workspace }}/${{ inputs.working-directory }}/_build/test/dialyxir_erlang-${{ matrix.otp-version }}_elixir-${{ matrix.elixir-version }}_deps-test.plt | ||
======= | ||
${{ github.workspace }}/${{ inputs.working-directory }}/priv/plts | ||
>>>>>>> 0037a87 (fix: issue on saving plt) | ||
======= | ||
${{ github.workspace }}/${{ inputs.working-directory }}/_build/test/dialyxir_erlang-${{ matrix.otp-version }}_elixir-${{ matrix.elixir-version }}_deps-test.plt | ||
>>>>>>> 0d90e76 (fix: issue on saving plt) | ||
- name: Check by dialyzer (Ubuntu) | ||
id: dialyzer | ||
if: ${{ inputs.perform-check && startsWith(runner.os, 'linux') }} | ||
continue-on-error: true | ||
run: mix dialyzer --format github | ||
- name: Run tests | ||
if: ${{ !inputs.perform-check }} | ||
run: mix test |