Merge pull request #1621 from vacanza/beta #3385
Workflow file for this run
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: CI/CD | |
on: | |
- merge_group | |
- pull_request | |
- push | |
- workflow_dispatch | |
env: | |
FORCE_COLOR: 1 | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
jobs: | |
pre-commit: | |
name: Run pre-commit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5.0.0 | |
with: | |
python-version: '3.11' | |
- name: Run pre-commit | |
uses: pre-commit/action@v3.0.0 | |
test: | |
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: | |
- pre-commit | |
strategy: | |
matrix: | |
os: | |
- macOS-latest | |
- ubuntu-latest | |
- windows-latest | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- 'pypy-3.9' | |
- 'pypy-3.10' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5.0.0 | |
with: | |
cache: pip | |
cache-dependency-path: | | |
requirements/runtime.txt | |
requirements/tests.txt | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade --requirement requirements/tests.txt | |
python -m pip install . | |
- name: Run tests | |
run: | | |
make test | |
- name: Upload coverage | |
uses: coverallsapp/github-action@v2 | |
with: | |
flag-name: tests-${{ matrix.python-version }}-${{ matrix.os }} | |
parallel: true | |
path-to-lcov: coverage.lcov | |
build: | |
name: Build distribution | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5.0.0 | |
with: | |
cache: pip | |
cache-dependency-path: requirements/runtime.txt | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade build polib | |
pip install . | |
- name: Build distribution | |
run: | | |
make package | |
- name: Upload package artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
finish-coveralls: | |
name: Finish coveralls | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true | |
publish-pypi-main: | |
name: Publish to PyPI | |
if: | | |
github.repository == 'vacanza/python-holidays' && | |
github.event_name == 'push' && | |
startsWith(github.event.ref, 'refs/tags/v') | |
environment: main | |
needs: | |
- build | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get package artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |