| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
- '*-maint' |
| 8 |
tags: |
| 9 |
- 'v*' |
| 10 |
pull_request: |
| 11 |
branches: |
| 12 |
- master |
| 13 |
- '*-maint' |
| 14 |
|
| 15 |
jobs: |
| 16 |
lint: |
| 17 |
runs-on: ubuntu-latest |
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v4 |
| 20 |
- uses: pre-commit/[email protected] |
| 21 |
env: |
| 22 |
RUFF_OUTPUT_FORMAT: github |
| 23 |
test: |
| 24 |
runs-on: ${{ matrix.os }} |
| 25 |
strategy: |
| 26 |
matrix: |
| 27 |
os: |
| 28 |
- "ubuntu-24.04" |
| 29 |
- "windows-2022" |
| 30 |
- "macos-14" |
| 31 |
python-version: |
| 32 |
- "3.8" |
| 33 |
- "3.9" |
| 34 |
- "3.10" |
| 35 |
- "3.11" |
| 36 |
- "3.12" |
| 37 |
- "3.13" |
| 38 |
- "pypy3.10" |
| 39 |
env: |
| 40 |
BABEL_CLDR_NO_DOWNLOAD_PROGRESS: "1" |
| 41 |
BABEL_CLDR_QUIET: "1" |
| 42 |
steps: |
| 43 |
- uses: actions/checkout@v4 |
| 44 |
- uses: actions/cache@v4 |
| 45 |
with: |
| 46 |
path: cldr |
| 47 |
key: cldr-${{ hashFiles('scripts/*cldr*') }} |
| 48 |
- name: Set up Python ${{ matrix.python-version }} |
| 49 |
uses: actions/setup-python@v5 |
| 50 |
with: |
| 51 |
python-version: ${{ matrix.python-version }} |
| 52 |
allow-prereleases: true |
| 53 |
cache: "pip" |
| 54 |
cache-dependency-path: "**/setup.py" |
| 55 |
- name: Install dependencies |
| 56 |
run: | |
| 57 |
python -m pip install --upgrade pip setuptools wheel |
| 58 |
python -m pip install 'tox~=4.0' 'tox-gh-actions~=3.0' |
| 59 |
- name: Run test via Tox |
| 60 |
run: tox --skip-missing-interpreters |
| 61 |
env: |
| 62 |
COVERAGE_XML_PATH: ${{ runner.temp }} |
| 63 |
BABEL_TOX_EXTRA_DEPS: pytest-github-actions-annotate-failures |
| 64 |
- uses: codecov/codecov-action@v5 |
| 65 |
with: |
| 66 |
directory: ${{ runner.temp }} |
| 67 |
flags: ${{ matrix.os }}-${{ matrix.python-version }} |
| 68 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 69 |
verbose: true |
| 70 |
build: |
| 71 |
runs-on: ubuntu-24.04 |
| 72 |
needs: lint |
| 73 |
steps: |
| 74 |
- uses: actions/checkout@v4 |
| 75 |
- uses: actions/setup-python@v5 |
| 76 |
with: |
| 77 |
python-version: "3.13" |
| 78 |
cache: "pip" |
| 79 |
cache-dependency-path: "**/setup.py" |
| 80 |
- run: pip install build -e . |
| 81 |
- run: make import-cldr |
| 82 |
- run: python -m build |
| 83 |
- uses: actions/upload-artifact@v4 |
| 84 |
with: |
| 85 |
name: dist |
| 86 |
path: dist |
| 87 |
publish: |
| 88 |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 89 |
needs: |
| 90 |
- build |
| 91 |
runs-on: ubuntu-latest |
| 92 |
environment: |
| 93 |
name: release |
| 94 |
url: https://pypi.org/p/babel/ |
| 95 |
permissions: |
| 96 |
id-token: write |
| 97 |
steps: |
| 98 |
- uses: actions/download-artifact@v4 |
| 99 |
with: |
| 100 |
name: dist |
| 101 |
path: dist/ |
| 102 |
- name: Publish package distributions to PyPI |
| 103 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 104 |
with: |
| 105 |
verbose: true |
| 106 |
print-hash: true |