Initialize v0.50 #3983
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 | |
with: | |
check-latest: true | |
python-version: '3.12' | |
- name: Run pre-commit | |
uses: pre-commit/action@v3.0.1 | |
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' | |
exclude: | |
- os: 'macos-latest' | |
python-version: '3.8' | |
- os: 'macos-latest' | |
python-version: '3.9' | |
- os: 'macos-latest' | |
python-version: 'pypy-3.9' | |
include: | |
- os: 'macos-13' | |
python-version: '3.8' | |
- os: 'macos-13' | |
python-version: '3.9' | |
- os: 'macos-13' | |
python-version: 'pypy-3.9' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
allow-prereleases: true | |
cache: pip | |
cache-dependency-path: | | |
requirements/runtime.txt | |
requirements/tests.txt | |
check-latest: true | |
python-version: ${{ matrix.python-version }} | |
- 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 | |
with: | |
cache: pip | |
cache-dependency-path: requirements/runtime.txt | |
check-latest: true | |
python-version: '3.12' | |
- 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 | |
test-build: | |
name: Test build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: build | |
strategy: | |
matrix: | |
os: | |
- macOS-latest | |
- ubuntu-latest | |
- windows-latest | |
steps: | |
- name: Check out Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
cache: pip | |
cache-dependency-path: | | |
requirements/runtime.txt | |
requirements/tests.txt | |
check-latest: true | |
python-version: '3.12' | |
- name: Get package artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Run tests | |
shell: bash | |
run: | | |
rm -rf holidays | |
python -m pip install --upgrade --requirement requirements/tests.txt | |
python -m pip install `ls dist/*.whl` | |
pytest --dist loadscope --numprocesses auto tests/countries tests/financial | |
python -m pip uninstall -y holidays python-dateutil six | |
python -m pip install `ls dist/*.tar.gz` | |
pytest --dist loadscope --numprocesses auto tests/countries tests/financial | |
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: | |
- test-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 |