Sync CalCat API changes from internal repo #748
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: Tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
release: | |
types: | |
- published | |
env: | |
PIP_CONSTRAINT: "${{ github.workspace }}/.github/dependabot/constraints.txt" | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.github/dependabot/constraints.txt') }} | |
- name: Install dependencies | |
# Note that we do an editable install so that coverage can look at the files in src/ | |
run: | | |
python3 -m pip install -e .[test] | |
- name: Test with pytest | |
run: | | |
python3 -m pytest --cov=src/ --cov-report=xml . | |
env: | |
CALCAT_OAUTH_CREDS: ${{ secrets.CALCAT_OAUTH_CREDS }} | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
build_wheels: | |
name: Build wheels | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_BUILD: cp310-* | |
CIBW_SKIP: "*-musllinux_* pp*" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
publish: | |
name: Publish release to PyPI | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
needs: [tests, build_wheels, build_sdist] | |
permissions: | |
id-token: write # OIDC for uploading to PyPI | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |