-
Notifications
You must be signed in to change notification settings - Fork 9
164 lines (139 loc) · 4.86 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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.0.1"]
elixir: ["1.17.2"]
zig: ["0.13.0"]
steps:
- name: Clone the repository
uses: actions/checkout@v4
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@v4
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@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-20.04
otp: "25.3"
elixir: "1.14"
- os: ubuntu-22.04
otp: "27.0.1"
elixir: "1.17.2"
# Use macos-13 since macos-lates doesn't seem to support AES hardware acceleration,
# 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
with:
submodules: recursive
- name: Fetch TigerBeetle for Linux
if: runner.os == 'Linux'
working-directory: ./src/tigerbeetle
run: |
curl -Lo tigerbeetle.zip https://linux.tigerbeetle.com && unzip tigerbeetle.zip
- name: Fetch TigerBeetle for Mac
if: runner.os == 'macOS'
working-directory: ./src/tigerbeetle
run: |
curl -Lo tigerbeetle.zip https://mac.tigerbeetle.com && unzip tigerbeetle.zip
- name: Fetch TigerBeetle for Windows
if: runner.os == 'Windows'
working-directory: ./src/tigerbeetle
run: |
curl.exe -Lo tigerbeetle.zip https://windows.tigerbeetle.com; Expand-Archive tigerbeetle.zip .
- name: Start TigerBeetle
working-directory: ./src/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: ${{ 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