1010 - cron : ' 0 0 * * 3'
1111
1212jobs :
13- clippy :
14- name : Clippy
15- runs-on : ubuntu-latest
16- steps :
17- - uses : actions/checkout@v1
18- - uses : actions-rs/toolchain@v1
19- with :
20- toolchain : stable
21- components : clippy
22- override : true
23- - uses : actions-rs/clippy-check@v1
24- with :
25- token : ${{ secrets.GITHUB_TOKEN }}
26- args : --all-targets --all-features -- -D warnings
27-
28- clippy-windows :
29- name : Clippy-Windows
30- runs-on : windows-latest
31- steps :
32- - uses : actions/checkout@v1
33- - name : Install Erlang/Elixir
34- run : choco install elixir
35- - name : Extend PATH
36- run : echo "C:\\ProgramData\\chocolatey\\lib\\Elixir\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
37- - name : Build API
38- working-directory : rustler_sys
39- run : |
40- cargo build
41- - uses : actions-rs/toolchain@v1
42- with :
43- toolchain : stable
44- components : clippy
45- override : true
46- - uses : actions-rs/clippy-check@v1
47- with :
48- token : ${{ secrets.GITHUB_TOKEN }}
49- args : --all-targets --all-features -- -D warnings
50-
5113 format :
5214 name : Format
5315 runs-on : ubuntu-latest
5416 steps :
55- - uses : actions/checkout@v1
56- - uses : actions-rs/toolchain@v1
17+ - uses : actions/checkout@v3
18+
19+ - uses : dtolnay/rust-toolchain@stable
5720 with :
58- toolchain : stable
59- components : rustfmt
60- override : true
21+ components : rustfmt
6122
6223 - name : Install Erlang/Elixir
6324 uses : erlef/setup-beam@v1
6425 with :
65- otp-version : " 25.0.0 "
66- elixir-version : " 1.13.4 "
26+ otp-version : " 25"
27+ elixir-version : " 1.14 "
6728
6829 - name : Check cargo fmt
69- uses : actions-rs/cargo@v1
70- with :
71- command : fmt
72- args : --all -- --check
30+ run : cargo fmt --all -- --check
7331
7432 - name : Check mix format (rustler_mix)
7533 working-directory : rustler_mix
@@ -79,123 +37,97 @@ jobs:
7937 working-directory : rustler_tests
8038 run : mix format --check-formatted
8139
82- rustler_mix_test :
83- runs-on : ubuntu-latest
40+ build :
41+ name : Build ${{matrix.os}} ${{matrix.toolchain}}
42+ runs-on : ${{matrix.os}}-latest
43+ strategy :
44+ matrix :
45+ os : [ubuntu, windows, macos]
46+ toolchain : [stable, nightly]
8447 steps :
85- - uses : actions/checkout@v1
48+ - uses : actions/checkout@v3
8649
87- - name : Install Rust stable toolchain
88- uses : actions-rs/toolchain@v1
50+ - uses : dtolnay/rust-toolchain@stable
8951 with :
90- toolchain : stable
91- override : true
52+ toolchain : ${{matrix.toolchain}}
9253
93- - name : Install Erlang/Elixir
94- uses : erlef/setup-beam@v1
54+ - uses : Swatinem/rust-cache@v2
9555 with :
96- otp-version : " 24.1.7 "
97- elixir-version : 1.13
56+ cache-on-failure : true
57+ shared-key : rustler
9858
99- - name : Test rustler_mix
100- working-directory : rustler_mix
101- run : ./test.sh
59+ - run : cargo build
10260
103- test_windows :
104- name : Windows
105- runs-on : windows-latest
61+ clippy :
62+ name : Clippy ${{matrix.os}}
63+ runs-on : ${{matrix.os}}-latest
64+ needs : [build]
65+ strategy :
66+ matrix :
67+ os : [ubuntu, windows, macos]
10668 steps :
107- - name : Checkout sources
108- uses : actions/checkout@v1
109-
110- - name : Install Erlang/Elixir
111- run : choco install elixir
69+ - uses : actions/checkout@v3
11270
113- - name : Install Rust stable toolchain
114- uses : actions-rs/toolchain@v1
71+ - uses : dtolnay/rust-toolchain@stable
11572 with :
116- toolchain : stable
117- override : true
73+ components : clippy
11874
119- - name : Extend PATH
120- run : echo "C:\\ProgramData\\chocolatey\\lib\\Elixir\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
75+ - uses : Swatinem/rust-cache@v2
76+ with :
77+ shared-key : rustler
78+ save-if : false
12179
122- - name : Hex
123- run : mix local.hex --force
124-
125- - name : Test rustler_mix
126- working-directory : rustler_mix
127- run : |
128- mix deps.get
129- mix test
130-
131- - name : Test rustler_tests
132- working-directory : rustler_tests
133- run : |
134- mix deps.get
135- mix test
80+ - run : cargo clippy --all-targets --all-features -- -D warnings
13681
13782 test :
138- name : OTP ${{matrix.pair.erlang}} / Elixir ${{matrix.pair.elixir}} / Rust ${{matrix.rust}}
139- runs-on : ubuntu-latest
83+ name : OTP ${{matrix.pair.erlang}} / Elixir ${{matrix.pair.elixir}} / Rust ${{matrix.rust}} / OS ${{matrix.os}}
84+ needs : [build]
14085 strategy :
14186 matrix :
14287 pair :
143- - { erlang: "25.0.0", elixir: "1.13.4" }
144- - { erlang: "24.3.4", elixir: "1.13.0" }
145- - { erlang: "24.3.4", elixir: "1.12.3" }
146- - { erlang: "24.3.4", elixir: "1.11.4" }
147- - { erlang: "23.3.4.14", elixir: "1.11.4" }
88+ - { erlang: "26", elixir: "1.14", latest: true }
89+ - { erlang: "25", elixir: "1.14" }
90+ - { erlang: "24", elixir: "1.13" }
14891 rust :
14992 - stable
150- - beta
15193 - nightly
94+ os :
95+ - macos
96+ - windows
97+ - ubuntu
98+ exclude :
99+ # TODO Remove this once setup-beam is fixed to work around OTP26's
100+ # regression
101+ - os : windows
102+ pair : { erlang: "26", elixir: "1.14", latest: true }
103+ runs-on : ${{matrix.os}}-latest
104+
152105 steps :
153106 - name : Checkout sources
154- uses : actions/checkout@v1
107+ uses : actions/checkout@v3
155108
156109 - name : Install Erlang/Elixir
157110 uses : erlef/setup-beam@v1
158111 with :
159112 otp-version : ${{matrix.pair.erlang}}
160113 elixir-version : ${{matrix.pair.elixir}}
114+ if : " !startsWith(matrix.os, 'macos')"
161115
162- - name : Install Rust ${{matrix.rust}} toolchain
163- uses : actions-rs/toolchain@v1
164- with :
165- toolchain : ${{matrix.rust}}
166- override : true
167-
168- - run : cargo test
169-
170- - name : Test rustler_mix
171- working-directory : rustler_mix
172- run : |
173- mix deps.get
174- mix test
175-
176- - name : Test rustler_tests
177- working-directory : rustler_tests
178- run : |
179- mix deps.get
180- mix test
181-
182- test_macos :
183- name : macos-11 test
184- runs-on : macos-11
185- steps :
186- - name : Checkout sources
187- uses : actions/checkout@v1
188-
189- - name : Install Erlang/Elixir
116+ - name : Install Erlang/Elixir with Brew
190117 run : |
191118 brew install elixir
192119 mix local.hex --force
120+ if : " startsWith(matrix.os, 'macos')"
193121
194122 - name : Install Rust ${{matrix.rust}} toolchain
195- uses : actions-rs/toolchain@v1
123+ uses : dtolnay/rust-toolchain@master
124+ with :
125+ toolchain : ${{matrix.rust}}
126+
127+ - uses : Swatinem/rust-cache@v2
196128 with :
197- toolchain : stable
198- override : true
129+ shared-key : rustler
130+ save-if : false
199131
200132 - run : cargo test
201133
@@ -210,3 +142,8 @@ jobs:
210142 run : |
211143 mix deps.get
212144 mix test
145+
146+ - name : Test mix project with example created from template
147+ working-directory : rustler_mix
148+ run : ./test.sh
149+ if : " startsWith(matrix.os, 'ubuntu') && matrix.pair.latest"
0 commit comments