-
Notifications
You must be signed in to change notification settings - Fork 17
55 lines (51 loc) · 1.78 KB
/
pytest_latest.yml
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
# Install scico requirements and run pytest with latest jax version
name: unit tests (latest jax)
# Controls when the workflow will run
on:
# Run workflow every Sunday at midnight UTC
schedule:
- cron: "0 0 * * 0"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
pytest-latest-jax:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Python 3
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install lastversion
run: |
python -m pip install --upgrade pip
pip install lastversion
- name: Install dependencies
run: |
rjaxlib=$(grep jaxlib requirements.txt | sed -e 's/jaxlib.*<=\([0-9\.]*$\)/\1/')
rjax=$(grep -E "jax[^lib]" requirements.txt | sed -e 's/jax.*<=\([0-9\.]*$\)/\1/')
ljaxlib=$(lastversion --at pip jaxlib)
ljax=$(lastversion --at pip jax)
echo jaxlib required: $rjaxlib latest: $ljaxlib
echo jax required: $rjax latest: $ljax
if [ "$rjaxlib" = "$ljaxlib" ] && [ "$rjax" = "$ljax" ]; then
echo Test is redundant: required and latest jaxlib/jax versions match
echo "TEST=cancel" >> $GITHUB_ENV
else
echo "TEST=run" >> $GITHUB_ENV
sudo apt-get install -y libopenblas-dev
pip install -r requirements.txt
pip install -r dev_requirements.txt
pip install -e .
pip install --upgrade "jax[cpu]"
fi
- name: Run tests with pytest
run: |
TEST="${{ env.TEST }}"
if [ "$TEST" = "run" ]; then
pytest
else
exit 0
fi