Skip to content

Commit 796de08

Browse files
committed
Improve ci workflow
1 parent f0c2f1f commit 796de08

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: ["**"]
48

59
jobs:
6-
check-elixir-formatting:
7-
name: Check Elixir formatting
10+
check-formatting:
11+
name: Check formatting
812
runs-on: ubuntu-latest
913
steps:
10-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
15+
16+
- uses: dtolnay/rust-toolchain@stable
17+
with:
18+
components: rustfmt
1119

1220
- name: Set up Elixir
1321
uses: erlef/setup-beam@v1
1422
with:
15-
otp-version: '25.0'
16-
elixir-version: '1.14.0'
23+
otp-version: 25.0
24+
elixir-version: 1.14.0
1725

18-
- name: Check formatting
26+
- name: Check Rust formatting
27+
working-directory: native/meeseeks_html5ever_nif
28+
run: cargo fmt --all -- --check
29+
30+
- name: Check Elixir formatting
1931
run: mix format --check-formatted
2032

33+
2134
test-elixir:
22-
name: Test with OTP ${{ matrix.otp }} and Elixir ${{ matrix.elixir }}
23-
# TODO change this to ubuntu-latest after OTP 23 is deprecated, see
24-
# https://github.com/erlef/setup-beam#compatibility-between-operating-system-and-erlangotp
25-
# for compatibility
26-
runs-on: ubuntu-20.04
35+
name: Test Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}
2736

2837
env:
2938
MIX_ENV: test
@@ -32,18 +41,17 @@ jobs:
3241
fail-fast: false
3342
matrix:
3443
include:
35-
- otp: '23.0'
36-
elixir: '1.12.0'
37-
- otp: '23.0'
38-
elixir: '1.14.3'
39-
- otp: '24.0'
40-
elixir: '1.12.0'
41-
- otp: '24.0'
42-
elixir: '1.14.3'
43-
- otp: '25.0'
44-
elixir: '1.13.4'
45-
- otp: '25.0'
46-
elixir: '1.14.3'
44+
- elixir: 1.12.0
45+
otp: 23.0
46+
- elixir: 1.13.0
47+
otp: 24.0
48+
- elixir: 1.14.0
49+
otp: 25.0
50+
51+
# TODO change this to ubuntu-latest after OTP 23 is deprecated, see
52+
# https://github.com/erlef/setup-beam#compatibility-between-operating-system-and-erlangotp
53+
# for compatibility
54+
runs-on: ubuntu-20.04
4755

4856
steps:
4957
- uses: actions/checkout@v3
@@ -58,36 +66,40 @@ jobs:
5866
elixir-version: ${{ matrix.elixir }}
5967

6068
- name: Retrieve cached Rust dependencies
61-
uses: actions/cache@v2
69+
uses: actions/cache@v3
6270
id: cargo-cache
6371
with:
6472
path: ~/.cargo
6573
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-cargo-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
6674
restore-keys: |
6775
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-cargo-
76+
6877
- name: Retrieve cached Elixir dependencies
69-
uses: actions/cache@v2
78+
uses: actions/cache@v3
7079
id: mix-cache
7180
with:
7281
path: deps
7382
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
7483
restore-keys: |
7584
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-
85+
7686
- name: Retrieve cached Elixir build
77-
uses: actions/cache@v2
87+
uses: actions/cache@v3
7888
id: build-cache
7989
with:
8090
path: _build
8191
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-${{ github.sha }}
8292
restore-keys: |
8393
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-
94+
8495
- name: Install Elixir dependencies
8596
if: steps.mix-cache.outputs.cache-hit != 'true'
8697
run: |
8798
mix local.rebar --force
8899
mix local.hex --force
89100
mix deps.get
90101
mix deps.compile
102+
91103
- name: Compile Elixir
92104
run: mix compile
93105

0 commit comments

Comments
 (0)