Fix MacOS CI #130
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: | |
# Run when pushing to stable branches | |
push: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
otp: ["25.3"] | |
elixir: ["1.14"] | |
zig: ["0.11.0"] | |
steps: | |
- name: Clone the repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install OTP and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Install Zig | |
uses: goto-bus-stop/setup-zig@v2 | |
with: | |
version: ${{ matrix.zig }} | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Install and compile dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: mix do deps.get --only test, deps.compile | |
- name: Check Elixir formatting | |
run: mix format --check-formatted | |
- name: Check Zig formatting | |
run: zig fmt --check src/*.zig | |
- name: Check no unused dependencies | |
run: mix do deps.get, deps.unlock --check-unused | |
if: ${{ steps.cache-deps.outputs.cache-hit != 'true' }} | |
- name: Compile with --warnings-as-errors | |
run: mix compile --warnings-as-errors --force | |
- name: Run credo static analysis | |
run: mix credo --strict | |
# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones | |
# Cache key based on Elixir & Erlang version (also useful when running in matrix) | |
- name: Cache Dialyzer's PLT | |
uses: actions/cache@v2 | |
id: cache-plt | |
with: | |
path: priv/plts | |
key: ${{ runner.os }}-otp${{ matrix.otp }}-elixir${{ matrix.elixir }} | |
# Create PLTs if no cache was found | |
- name: Create PLTs | |
if: steps.cache-plt.outputs.cache-hit != 'true' | |
run: mix dialyzer --plt | |
- name: Run Dialyzer | |
run: mix dialyzer --format github | |
test: | |
name: Test on ${{ matrix.os }} (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
otp: "25.3" | |
elixir: "1.14" | |
- os: ubuntu-22.04 | |
otp: "26.0.2" | |
elixir: "1.15.2" | |
- os: macos-13 | |
otp: "26.0.2" | |
elixir: "1.15.2" | |
steps: | |
- name: Clone the repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install and start TigerBeetle | |
working-directory: ./src/tigerbeetle | |
run: | | |
./bootstrap.sh | |
./tigerbeetle format --cluster=0 --replica=0 --replica-count=1 0_0.tigerbeetle | |
./tigerbeetle start --addresses=3000 0_0.tigerbeetle & | |
- name: Install OTP and Elixir | |
if: runner.os == 'Linux' | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Install OTP and Elixir | |
if: runner.os == 'macOS' | |
run: | | |
brew install --force --overwrite elixir | |
mix local.hex --force | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ matrix.os }}-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} | |
- name: Install and compile dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
mix deps.get --only test | |
mix deps.compile | |
- name: Run tests | |
run: mix test |