Skip to content

Speed up tests

Speed up tests #778

Workflow file for this run

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') }}
restore-keys: |
${{ runner.os }}-mix-
- 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 }}
- run: mix test
- 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 != '' }}