PyPI package tests #30
This file contains hidden or 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: 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.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
# Set the environment variables to be used in all jobs defined in this workflow | |
env: | |
CI_BRANCH: ${{ github.head_ref || github.ref_name }} | |
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
jobs: | |
pypi-package-tests: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up pixi | |
uses: prefix-dev/[email protected] | |
with: | |
run-install: false | |
cache: false | |
post-cleanup: false | |
- name: | |
Download the pixi configuration file from the ${{ env.CI_BRANCH}} | |
branch | |
shell: bash | |
run: | | |
curl -LO https://raw.githubusercontent.com/easyscience/diffraction-lib/${CI_BRANCH}/pixi.toml | |
- name: Download the tests from the ${{ env.DEFAULT_BRANCH }} branch | |
shell: bash | |
run: | | |
curl -LO https://github.com/easyscience/diffraction-lib/archive/refs/heads/${DEFAULT_BRANCH}.zip | |
unzip ${DEFAULT_BRANCH}.zip -d . | |
mkdir -p tests | |
cp -r diffraction-lib-${DEFAULT_BRANCH}/tests/* tests/ | |
rm -rf ${DEFAULT_BRANCH}.zip diffraction-lib-${DEFAULT_BRANCH} | |
- name: Create the environment and install dependencies | |
run: pixi install | |
- name: Install package from PyPI with dev and visualization extras | |
run: | | |
pixi add --pypi "easydiffraction[dev,visualization]" | |
pixi run easydiffraction --version | |
- name: Run unit tests to verify the installation | |
run: pixi run unit-tests | |
- name: Run functional tests to verify the installation | |
run: pixi run func-tests | |
# Github token to avoid hitting the unauthenticated API rate limit | |
- name: List and fetch the EasyDiffraction tutorials | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
pixi run tutorials-list | |
pixi run tutorials-fetch | |
- name: Test tutorials as notebooks | |
run: pixi run notebook-tests |