Integration Tests #3732
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
name: Integration Tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: '42 5 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run | |
# by the push to the branch. | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install package and development dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ${GITHUB_WORKSPACE}[style,test,wheel] | |
- name: Linting with flake8 | |
run: | | |
flake8 --count --statistics . | |
- name: Style check with black | |
run: | | |
black --check --diff . | |
- name: Run test suite with pytest | |
run: | | |
(cd .. && pytest --durations=0 $GITHUB_WORKSPACE/tests/ --log-file=$GITHUB_WORKSPACE/tests.log) | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
check-wheel-contents dist/*.whl | |
- name: upload artifacts | |
if: matrix.python-version == 3.8 # only upload from one version (oldest, for max compatibility) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
testpypi-publish: | |
name: Upload release to TestPyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/PyFstat | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Download dist artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish package distributions to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
pypi-publish: | |
name: Upload release to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [build, testpypi-publish] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/PyFstat | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Download dist artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |