initial version of the update pdffit2 interface #132
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
# This workflow will for a variety of Python versions | |
# - install the code base | |
# - lint the code base | |
# - test the code base | |
# - upload the test coverage to codecov | |
# | |
# It will also | |
# - build the package | |
# - check the package | |
# | |
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Build and test package | |
on: | |
# Trigger the workflow on push | |
push: | |
# Every branch | |
branches: | |
- "**" | |
# But do not run this workflow on creating a new tag starting with 'v', e.g. 'v1.0.3' (see pypi-publish.yml) | |
tags-ignore: | |
- 'v*' | |
# Trigger the workflow on pull request | |
pull_request: | |
branches: | |
- "**" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Allow only one concurrent workflow, skipping runs queued between the run in-progress and latest queued. | |
# And cancel in-progress runs. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# Job 1: Build the package | |
build-package: | |
# current job matrix. if modified, remember to UPDATE the strategy in the next job | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-24.04, windows-2022, macos-13, macos-14] | |
python-version: ['3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade package installer for Python | |
run: python -m pip install --upgrade pip | |
- name: Install Python dependencies | |
run: pip install '.[dev]' | |
- name: Create Python package # dist/*.whl | |
run: python -m build --wheel --outdir dist | |
- name: Upload zipped Python package (with tests and examples) for next job | |
uses: actions/upload-artifact@v4 | |
with: | |
name: EasyDiffractionLib_py${{ matrix.python-version }}_${{ matrix.os }}_${{ runner.arch }} | |
path: | | |
dist/*.whl | |
tests/ | |
examples/ | |
if-no-files-found: "error" | |
compression-level: 0 | |
# Job 2: Test the package | |
test-package: | |
needs: build-package # previous job 'code-testing' need to be finished first | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-24.04, windows-2022, macos-13, macos-14] | |
python-version: ['3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade package installer for Python | |
run: python -m pip install --upgrade pip | |
- name: Download zipped Python package (with tests and examples) from previous job | |
uses: actions/download-artifact@v4 | |
with: # name or path are taken from the upload step of the previous job | |
name: EasyDiffractionLib_py${{ matrix.python-version }}_${{ matrix.os }}_${{ runner.arch }} | |
path: . # directory to extract downloaded zipped artifacts | |
- name: Install Python package from previous job with 'dev' extras | |
run: pip install 'easydiffraction[dev]' --find-links=dist | |
- name: Run Python tests | |
run: > | |
pytest tests/ | |
--color=yes | |
-n auto | |
- name: Run tests on Jupyter Notebooks | |
shell: bash | |
run: > | |
pytest | |
--nbmake examples | |
--ignore-glob='examples/*emcee*' | |
--nbmake-timeout=300 | |
--color=yes | |
-n=auto |