Skip to content

Remove TODO

Remove TODO #1195

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
with:
# We need the previous commit for git diff later
fetch-depth: 2
- 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 }}
- name: Diff tests
run: |
changed_tests="$(git diff --name-only --diff-filter=AMRC HEAD^1 'test/**/*_test.exs' | tr '\n' ' ')"
echo "Changed test files: $changed_tests"
echo "CHANGED_TESTS=$changed_tests" >> $GITHUB_ENV
- 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.CHANGED_TESTS }} || [ $? -ne 100 ]
if: ${{ matrix.slow && env.CHANGED_TESTS != '' }}