-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce github pytest
workflow runtime using pytest-split
#390
Changes from all commits
f9c59e3
974673e
3a49c43
eaa47a6
b377f3f
9f884f9
a447060
083cc5c
058c301
f1d2f86
74c5941
f42c0fb
cb057d4
73724de
cb1456a
8931aca
8924ec0
3a5d83b
9c059d9
81f9550
1190505
69b933f
5c5adba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,33 +2,27 @@ | |
|
||
name: lint | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
lint: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
|
||
python-version: "3.9" | ||
- name: Black code formatter | ||
uses: psf/black@stable | ||
with: | ||
version: "22.3" | ||
|
||
- name: Isort import sorter | ||
uses: isort/[email protected] | ||
uses: isort/isort-action@v1 | ||
- name: Pylint code analysis | ||
run: | | ||
pip install pylint | ||
pylint --disable=all --enable=missing-docstring scico |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,32 +2,25 @@ | |
|
||
name: mypy | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
mypy: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install Python 3 | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
python-version: "3.9" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous comment on python version. |
||
- name: Install dependencies | ||
run: | | ||
pip install mypy | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# When a tag is pushed, build packages and upload to PyPI | ||
|
||
name: pypi | ||
name: pypi upload | ||
|
||
# Trigger when tags are pushed | ||
on: | ||
|
@@ -15,13 +15,13 @@ jobs: | |
name: Upload package to PyPI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install Python 3 | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
python-version: "3.9" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. version |
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Install scico requirements and run pytest with latest jax version | ||
|
||
name: unit tests -- latest jax | ||
name: unit tests (latest jax) | ||
|
||
# Controls when the workflow will run | ||
on: | ||
|
@@ -13,19 +13,15 @@ on: | |
|
||
jobs: | ||
pytest-latest-jax: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install Python 3 | ||
uses: actions/setup-python@v1 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
python-version: "3.9" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. version |
||
- name: Install lastversion | ||
run: | | ||
python -m pip install --upgrade pip | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Install scico requirements and run pytest | ||
|
||
name: unit tests (macos) | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
group: [1, 2, 3, 4, 5] | ||
name: pytest split ${{ matrix.group }} (macos) | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
# Check-out the repository under $GITHUB_WORKSPACE | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
# Set up conda/mamba environment | ||
- name: Set up mambaforge | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
activate-environment: test-env | ||
use-mamba: true | ||
python-version: "3.9" | ||
# Configure conda environment cache | ||
- name: Set up conda environment cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.CONDA }}/envs | ||
key: conda-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev_requirements.txt') }}-${{ env.CACHE_NUMBER }} | ||
env: | ||
CACHE_NUMBER: 1 # Increase this value to force cache reset | ||
id: cache | ||
# Display environment details | ||
- name: Display environment details | ||
run: | | ||
conda info | ||
printenv | sort | ||
# Install dependencies in conda environment | ||
- name: Install dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
mamba install -c conda-forge pytest pytest-cov | ||
python -m pip install --upgrade pip | ||
pip install pytest-split | ||
pip install -r requirements.txt | ||
pip install -r dev_requirements.txt | ||
mamba install -c astra-toolbox astra-toolbox | ||
mamba install -c conda-forge pyyaml | ||
pip install --upgrade --force-reinstall scipy>=1.6.0 # Temporary fix for GLIBCXX_3.4.30 not found in conda forge version | ||
pip install bm4d>=4.0.0 | ||
pip install "ray[tune]>=2.0.0" | ||
pip install hyperopt | ||
# Install package to be tested | ||
- name: Install package to be tested | ||
run: pip install -e . | ||
# Run unit tests | ||
- name: Run main unit tests | ||
run: pytest -x --splits 5 --group ${{ matrix.group }} | ||
# Run doc tests | ||
- name: Run doc tests | ||
if: matrix.group == 1 | ||
run: | | ||
pytest --ignore-glob="*test_*.py" --doctest-modules scico |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs state "SCICO requires Python version 3.7 or later." Given that, I suggest that it would be safer to run the tests on 3.7, as I assume code that works in 3.7 will also work in 3.9 but probably not the reverse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I agree. I would argue that it's more important to test against the "recommended" version of Python than the minimal supported version. It's perhaps a bit more likely that code that works in 3.7 will work in 3.9 than vice-versa, but it's far more serious if it doesn't work in 3.9 since 3.7 is only supported to allow use of google colab. Perhaps a reasonable alternative would be to introduce a periodic (weekly or montly) test across multiple Python version, along the same lines as the existing "jax latest" test.