Skip to content
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

ci: merge test jobs #367

Merged
merged 10 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .constraints/py3.6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ nbconvert==6.0.7
nbdime==3.1.1
nbformat==5.1.3
nbmake==1.0
nest-asyncio==1.5.1
nest-asyncio==1.5.4
nodeenv==1.6.0
notebook==6.4.6
numba==0.53.1
Expand Down
6 changes: 3 additions & 3 deletions .constraints/py3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ iminuit==2.8.4
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
ipykernel==6.5.1
ipython==7.30.0
ipykernel==6.6.0
ipython==7.30.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
isort==5.10.1
Expand Down Expand Up @@ -123,7 +123,7 @@ nbconvert==6.3.0
nbdime==3.1.1
nbformat==5.1.3
nbmake==1.0
nest-asyncio==1.5.1
nest-asyncio==1.5.4
nodeenv==1.6.0
notebook==6.4.6
numba==0.54.1
Expand Down
6 changes: 3 additions & 3 deletions .constraints/py3.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ iminuit==2.8.4
importlib-metadata==4.8.2
importlib-resources==5.4.0
iniconfig==1.1.1
ipykernel==6.5.1
ipython==7.30.0
ipykernel==6.6.0
ipython==7.30.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
isort==5.10.1
Expand Down Expand Up @@ -122,7 +122,7 @@ nbconvert==6.3.0
nbdime==3.1.1
nbformat==5.1.3
nbmake==1.0
nest-asyncio==1.5.1
nest-asyncio==1.5.4
nodeenv==1.6.0
notebook==6.4.6
numba==0.54.1
Expand Down
6 changes: 3 additions & 3 deletions .constraints/py3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ imagesize==1.3.0
iminuit==2.8.4
importlib-metadata==4.8.2
iniconfig==1.1.1
ipykernel==6.5.1
ipython==7.30.0
ipykernel==6.6.0
ipython==7.30.1
ipython-genutils==0.2.0
ipywidgets==7.6.5
isort==5.10.1
Expand Down Expand Up @@ -121,7 +121,7 @@ nbconvert==6.3.0
nbdime==3.1.1
nbformat==5.1.3
nbmake==1.0
nest-asyncio==1.5.1
nest-asyncio==1.5.4
nodeenv==1.6.0
notebook==6.4.6
numba==0.54.1
Expand Down
3 changes: 3 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"autoupdate",
"axhline",
"axvline",
"bdist",
"cano",
"celltoolbar",
"cmin",
Expand Down Expand Up @@ -187,6 +188,7 @@
"phsp",
"precommit",
"prefactor",
"prereleased",
"pwa's",
"py's",
"pygments",
Expand All @@ -199,6 +201,7 @@
"rightarrow",
"rtfd",
"scipy",
"sdist",
"seealso",
"sharex",
"sharey",
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# cspell:ignore bdist noreply prereleased sdist

name: CD

on:
Expand All @@ -10,16 +8,27 @@ on:

jobs:
push:
name: Push to stable branch
name: Push to version branches
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Push to stable branch
- name: Configure Git credentials
run: |
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git push origin HEAD:refs/heads/stable -f
- name: Push to stable branch
run: |
git push origin HEAD:refs/heads/stable
- name: Push to matching minor version branch
env:
TAG: ${{ github.ref_name }}
run: |
re='^([0-9]+)\.([0-9]+)\.[0-9]+'
if [[ $TAG =~ $re ]]; then
MINOR_VERSION_BRANCH="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.x"
git push origin HEAD:refs/heads/$MINOR_VERSION_BRANCH
fi

pypi:
name: Publish to PyPI
Expand All @@ -31,7 +40,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
37 changes: 7 additions & 30 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.7]
python-version: ["3.7"]
steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -46,40 +46,17 @@ jobs:
name: Unit tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.6", "3.7", "3.8", "3.9"]
exclude:
- os: ubuntu-20.04 # coverage job
python-version: 3.7
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -c .constraints/py${{ matrix.python-version }}.txt -e .[test]
- name: Run unit tests and doctests with pytest
env:
CUDA_VISIBLE_DEVICES: "-1"
run: pytest -n auto
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: test_output_${{ matrix.os }}_${{ matrix.python-version }}
path: tests/output

pytest-macos:
name: Unit tests (MacOS)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11]
python-version: [3.7]
python-version: "3.7"
include:
- os: macos-11
python-version: "3.7"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
51 changes: 31 additions & 20 deletions .github/workflows/requirements-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,30 @@ on:
- epic/*

jobs:
diff:
name: Check dependency changes
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine dependency changes
run: |
DIFF="$(git diff origin/main --color -- .constraints .pre-commit-config.yaml setup.cfg)"
echo ::set-output name=diff::"${DIFF}"
id: diff
outputs:
diff: ${{ steps.diff.outputs.diff }}

pip-constraints:
name: Update pip constraints files
name: Update pip constraints
needs: diff
if: >
github.event.pull_request.head.repo.full_name == github.repository &&
needs.diff.outputs.diff != ''
# Only run if PR does not come from a fork
# https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand All @@ -20,40 +42,29 @@ jobs:
- "3.9"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if there are dependency changes
run: |
DIFF="$(git diff origin/main --color -- .constraints setup.cfg)"
echo ::set-output name=diff::"${DIFF}"
id: diff
- uses: ComPWA/update-pip-constraints@main
if: steps.diff.outputs.diff != ''
with:
python-version: ${{ matrix.python-version }}

pre-commit:
name: pre-commit autoupdate
needs: diff
if: >
github.event.pull_request.head.repo.full_name == github.repository &&
needs.diff.outputs.diff != ''
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if there are changes to pre-commit config
run: |
DIFF="$(git diff origin/main --color -- .pre-commit-config.yaml)"
echo ::set-output name=diff::"${DIFF}"
id: diff
- uses: ComPWA/update-pre-commit@main
if: steps.diff.outputs.diff != ''

push:
name: Push changes
if: github.event.pull_request.head.repo.full_name == github.repository
# Only run if PR does not come from a fork
# https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow
if: >
github.event.pull_request.head.repo.full_name == github.repository &&
needs.diff.outputs.diff != ''
runs-on: ubuntu-20.04
needs:
- diff
- pip-constraints
- pre-commit
steps:
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.0.89
rev: 0.0.92
hooks:
- id: check-dev-files
args:
Expand All @@ -63,7 +63,7 @@ repos:
- id: blacken-docs

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v5.6.10
rev: v5.6.11
hooks:
- id: cspell

Expand Down Expand Up @@ -126,7 +126,7 @@ repos:
- id: pydocstyle

- repo: https://github.com/ComPWA/mirrors-pyright
rev: v1.1.190
rev: v1.1.191
hooks:
- id: pyright

Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ filterwarnings =
ignore:Passing a schema to Validator.iter_errors is deprecated.*:DeprecationWarning
ignore:invalid value encountered in log.*:RuntimeWarning
ignore:invalid value encountered in sqrt:RuntimeWarning
ignore:numpy.ufunc size changed, may indicate binary incompatibility.*:RuntimeWarning
norecursedirs =
_build
markers =
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ commands =
--cov-report=xml \
--cov=tensorwaves

[testenv:testnb]
[testenv:nb]
description =
Run all notebooks with pytest
allowlist_externals =
Expand Down