-
Notifications
You must be signed in to change notification settings - Fork 102
71 lines (70 loc) · 2.29 KB
/
test.yaml
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
name: Test
on:
pull_request:
push:
branches:
- main
jobs:
main:
name: "main (${{ matrix.pair.elixir }}, ${{ matrix.pair.otp }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- pair:
elixir: "1.15.4"
otp: "26.0.2"
lint: true
slow: true
- pair:
elixir: "1.14.5"
otp: "25.3.2.2"
env:
MIX_ENV: test
XLA_CACHE_DIR: ${{ github.workspace }}/cache/xla
LIBTORCH_DIR: ${{ github.workspace }}/cache/torch
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.pair.otp }}
elixir-version: ${{ matrix.pair.elixir }}
- uses: actions/cache@v3
with:
path: |
deps
_build
cache
key: ${{ runner.os }}-mix-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}-${{ hashFiles('**/mix.lock') }}
- run: mix deps.get
- run: mix format --check-formatted
if: ${{ matrix.lint }}
- run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}
- run: mix deps.compile
- run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}
- name: Restore bumblebee cache
id: cache-bumblebee-restore
uses: actions/cache/restore@v3
with:
path: bumblebee_cache
key: ${{ runner.os }}-bumblebee-cache-${{ matrix.pair.elixir }}-${{ matrix.pair.otp }}
- run: mix test
env:
BUMBLEBEE_CACHE_DIR: ${{ github.workspace }}/bumblebee_cache
- name: Save bumblebee cache
id: cache-bumblebee-save
uses: actions/cache/save@v3
with:
path: bumblebee_cache
key: ${{ steps.cache-bumblebee-restore.outputs.cache-primary-key }}
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: test/**/*_test.exs
- name: Changed slow tests
# mix test exits with a non-zero code if there are no matching tests,
# so we make sure we fail only when the test suite fails
run: mix test test/bumblebee_test.exs --only slow --exit-status 100 ${{ env.GIT_DIFF_FILTERED }} || [ $? -ne 100 ]
if: ${{ matrix.slow && env.GIT_DIFF_FILTERED != '' }}