Skip to content

PyPI package tests

PyPI package tests #99

Workflow file for this run

name: PyPI package tests
on:
# Run daily, at 00:00.
schedule:
- cron: '0 0 * * *'
# 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.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Job 1: Test installation from PyPI on multiple OS
pypi-package-tests:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up pixi
uses: ./.github/actions/setup-pixi
with:
environments: ''
activate-environment: ''
run-install: false
frozen: false
- name: Init pixi project
run: pixi init easydiffraction
- name: Configure Pixi platforms
working-directory: easydiffraction
shell: bash
run: |
set -euo pipefail
case "$RUNNER_OS" in
Linux)
pixi_platforms='[{ name = "linux-64-glibc-2-35", platform = "linux-64", glibc = "2.35" }]'
;;
macOS)
pixi_platforms='[{ name = "osx-arm64-macos-14-0", platform = "osx-arm64", macos = "14.0" }]'
;;
Windows)
pixi_platforms='["win-64"]'
;;
*)
echo "Unsupported runner OS: $RUNNER_OS"
exit 1
;;
esac
PIXI_PLATFORMS="$pixi_platforms" python -c 'import os, pathlib; path = pathlib.Path("pixi.toml"); text = path.read_text(); path.write_text(text.replace(text.split("platforms = ", 1)[1].split("\n", 1)[0], os.environ["PIXI_PLATFORMS"], 1))'
pixi workspace platform list
- name: Add Python 3.14
working-directory: easydiffraction
run: pixi add "python=3.14"
# GNU Scientific Library (required by diffpy.pdffit2)
# libc++ for macOS (required by diffpy.pdffit2)
- name: Add other Conda dependencies
working-directory: easydiffraction
run: |
pixi add gsl
pixi add --platform osx-arm64 libcxx
- name: Add easydiffraction (with dev dependencies) from PyPI
working-directory: easydiffraction
run: pixi add --pypi "easydiffraction[dev]"
- name: Run unit tests to verify the installation
working-directory: easydiffraction
run: pixi run python -m pytest ../tests/unit/ --color=yes -v
- name: Run functional tests to verify the installation
if: ${{ !cancelled() }}
working-directory: easydiffraction
run: pixi run python -m pytest ../tests/functional/ --color=yes -v
- name: Run integration tests to verify the installation
if: ${{ !cancelled() }}
working-directory: easydiffraction
run: pixi run python -m pytest ../tests/integration/ --color=yes -n auto
# Job 2: Build and publish dashboard (reusable workflow)
run-reusable-workflows:
needs: pypi-package-tests # depend on previous job
uses: ./.github/workflows/dashboard.yml
secrets: inherit