bump minimum python to 39 #23
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: release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
pull_request: | |
merge_group: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
env: | |
MINIMUM_PYTHON_VERSION: "3.9" | |
UV_VERSION: "0.4.18" | |
UV_CACHE_DIR: /tmp/.uv-cache | |
jobs: | |
build: | |
# This action builds distribution files for upload to PyPI | |
name: ubuntu / 3.9 / build | |
runs-on: ubuntu-latest | |
steps: | |
#---------------------------------------------- | |
# check-out repo and set-up python | |
#---------------------------------------------- | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
#---------------------------------------------- | |
# ----- setup python ----- | |
#---------------------------------------------- | |
- name: Set up the environment | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ env.MINIMUM_PYTHON_VERSION }} | |
#---------------------------------------------- | |
# ----- setup uv and load cache ----- | |
#---------------------------------------------- | |
- name: Set up uv | |
run: curl -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.uv-cache | |
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
uv-${{ runner.os }} | |
#---------------------------------------------- | |
# ----- build distribution ----- | |
#---------------------------------------------- | |
- name: Build distribution | |
run: make build | |
#---------------------------------------------- | |
# ----- upload artifacts ----- | |
#---------------------------------------------- | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi_files | |
path: dist | |
- name: Minimize uv cache | |
run: uv cache prune --ci | |
test-build: | |
# This action runs the test suite on the built artifact in the `build` action. | |
# The default is to run this in ubuntu, macos and windows | |
name: ${{ matrix.os }} / 3.9 / test built artifact | |
needs: [build] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu | |
- macos | |
- windows | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MINIMUM_PYTHON_VERSION }} | |
- name: get dist artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypi_files | |
path: dist | |
- run: rm -r src/parallel_corpus | |
- run: pip install typing-extensions | |
- run: pip install -r tests/requirements-testing.lock | |
- run: pip install parallel-corpus --no-index --no-deps --find-links dist --force-reinstall | |
- run: pytest | |
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks | |
release-check: | |
if: always() | |
needs: | |
- build | |
- test-build | |
runs-on: ubuntu-latest | |
permissions: {} | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
# allowed-failures: coverage | |
publish: | |
# This action publishes the built and tested artifact to PyPI, but only on a tag | |
needs: | |
- test-build | |
if: success() && startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ env.MINIMUM_PYTHON_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.MINIMUM_PYTHON_VERSION }} | |
- name: get dist artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypi_files | |
path: dist | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |