unit tests (latest jax) #499
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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@v3 | |
with: | |
submodules: recursive | |
- name: Install Python 3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- 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 |