Skip to content

Update CI

Update CI #332

Workflow file for this run

name: Test
on: [push, pull_request]
jobs:
check-tag:
runs-on: ubuntu-latest
outputs:
publish_url: ${{ steps.check-publish.outputs.publish_url }}
steps:
- name: Check if this is a release/prerelease
id: check-publish
run: |
tag_name="${GITHUB_REF#refs/tags/}"
if [[ "$tag_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+[ab][0-9]+$ ]]; then
publish_url="https://test.pypi.org/legacy/"
elif [[ "$tag_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
publish_url="https://upload.pypi.org/legacy/"
else
publish_url="none"
fi
echo "publish_url=$publish_url" >> "$GITHUB_OUTPUT"
echo "tag_name=$tag_name"
echo "publish_url=$publish_url"
build-sdist:
# Run on external PRs, but not on internal PRs, to avoid duplicate runs
if: |
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: build-sdist
path: ${{ github.workspace }}/dist/*.tar.gz
test-with-pip:
name: Test with pip
needs: build-sdist
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Python ${{ matrix.python-version}}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test package
run: |
pip install nox
nox --verbose --force-python=${{ matrix.python-version }} -s test-with-pip
build-with-conda:
name: Test with conda
needs: build-sdist
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: true
- name: Show conda installation info
run: |
conda list
conda info
- name: Test package
run: |
pip install nox
nox --verbose --force-python=${{ matrix.python-version }} -s test-with-conda