Skip to content

Add Windows CI

Add Windows CI #208

Workflow file for this run

name: CI
on:
pull_request:
# Run when pushing to stable branches
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
otp: ["27.2.4"]
elixir: ["1.18.2-otp-27"]
zig: ["0.13.0"]
steps:
- name: Clone the repository
uses: actions/checkout@v4
- 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@v4
with:
path: |
deps
_build
key: lint-${{ 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@v4
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-22.04
otp: "25.3"
elixir: "1.14"
- os: ubuntu-24.04
otp: "27.2.4"
elixir: "1.18.2-otp-27"
# Use macos-13 since the macos-14 and macos-15 runners seemingly miss AES
# hardware acceleration support, which makes TigerBeetle fail at compile time
- os: macos-13
# These actually are not relevant since brew just pulls the latest version
otp: "latest"
elixir: "latest"
- os: windows-2022
otp: "27.0.1"
elixir: "1.17.2"
steps:
- name: Clone the repository
uses: actions/checkout@v4
- name: Fetch TigerBeetle for Linux
if: runner.os == 'Linux'
run: |
curl -Lo tigerbeetle.zip https://linux.tigerbeetle.com && unzip tigerbeetle.zip
- name: Fetch TigerBeetle for Mac
if: runner.os == 'macOS'
run: |
curl -Lo tigerbeetle.zip https://mac.tigerbeetle.com && unzip tigerbeetle.zip
- name: Fetch TigerBeetle for Windows
if: runner.os == 'Windows'
run: |
powershell -command "curl.exe -Lo tigerbeetle.zip https://windows.tigerbeetle.com; Expand-Archive tigerbeetle.zip .; .\tigerbeetle version"
- name: Start TigerBeetle
run: |
./tigerbeetle format --cluster=0 --replica=0 --replica-count=1 --development 0_0.tigerbeetle
./tigerbeetle start --addresses=3000 --development 0_0.tigerbeetle &
- name: Install OTP and Elixir
if: runner.os == 'Linux' || runner.os == 'Windows'
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 elixir
mix local.hex --force
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: |
deps
_build
key: test-${{ 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