Skip to content

Commit a0a77b0

Browse files
committed
Add GitHub Actions CI
- precommit job on macos-14 (arm64): runs mix precommit on every PR and push to main. Caches deps, _build, and the MLX prebuilt archive (~100 MB) so subsequent runs don't re-download. - soak job: nightly-only (17 3 UTC), runs the :soak tag. - concurrency group cancels superseded runs on the same ref.
1 parent 38a7b67 commit a0a77b0

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
# Nightly soak at 03:17 UTC.
10+
- cron: "17 3 * * *"
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
precommit:
18+
name: precommit (${{ matrix.os }})
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
# Emily is Apple-Silicon only. macos-14 is arm64 (M1).
24+
os: [macos-14]
25+
env:
26+
MIX_ENV: test
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Setup Beam
31+
uses: erlef/setup-beam@v1
32+
with:
33+
version-file: .tool-versions
34+
version-type: strict
35+
36+
- name: Cache MLX prebuilt
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/Library/Caches/emily
40+
key: mlx-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('mix.exs') }}
41+
42+
- name: Cache deps
43+
uses: actions/cache@v4
44+
with:
45+
path: deps
46+
key: deps-${{ runner.os }}-${{ hashFiles('mix.lock') }}
47+
restore-keys: deps-${{ runner.os }}-
48+
49+
- name: Cache build
50+
uses: actions/cache@v4
51+
with:
52+
path: _build
53+
key: build-${{ runner.os }}-${{ hashFiles('mix.lock', 'c_src/**', 'Makefile', '.tool-versions') }}
54+
restore-keys: build-${{ runner.os }}-
55+
56+
- run: mix deps.get
57+
58+
- run: mix precommit
59+
60+
soak:
61+
name: soak
62+
# Soak is noisy (500 × 4 MB allocations); only run on the nightly
63+
# schedule, not on every PR.
64+
if: github.event_name == 'schedule'
65+
runs-on: macos-14
66+
env:
67+
MIX_ENV: test
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Setup Beam
72+
uses: erlef/setup-beam@v1
73+
with:
74+
version-file: .tool-versions
75+
version-type: strict
76+
77+
- name: Cache MLX prebuilt
78+
uses: actions/cache@v4
79+
with:
80+
path: ~/Library/Caches/emily
81+
key: mlx-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('mix.exs') }}
82+
83+
- run: mix deps.get
84+
- run: mix compile
85+
- run: mix test --only soak

0 commit comments

Comments
 (0)