Use Github OIDC as a Trusted publisher on PyPI #4288
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: Resolwe CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+*" | |
pull_request: | |
schedule: | |
- cron: "30 2 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
env: | |
RESOLWE_COMMUNICATOR_IMAGE: "resolwe/com:testing" | |
runs-on: arc-runner | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- toxenv: "py311" | |
description: "Unit tests (Python 3.11)" | |
- toxenv: "py312" | |
description: "Unit tests (Python 3.12)" | |
- toxenv: "linters" | |
description: "Linters (Python 3.12)" | |
- toxenv: "packaging" | |
description: "Packaging (Python 3.12)" | |
- toxenv: "migrations" | |
description: "Migrations (Python 3.12)" | |
name: ${{ matrix.description }} | |
services: | |
postgres: | |
image: public.ecr.aws/docker/library/postgres:16 | |
ports: | |
- 55432:5432 | |
env: | |
POSTGRES_USER: resolwe | |
POSTGRES_DB: resolwe | |
POSTGRES_PASSWORD: resolwe | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
redis: | |
image: public.ecr.aws/docker/library/redis:7-alpine | |
ports: | |
- 56379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build communication container | |
if: matrix.toxenv == 'py311' || matrix.toxenv == 'py312' | |
working-directory: ./resolwe/flow/docker_images | |
run: docker build -f Dockerfile.communication -t ${{ env.RESOLWE_COMMUNICATOR_IMAGE }} ../../ | |
- name: ${{ matrix.description }} | |
env: | |
GITHUB_ACTIONS_DEBUG: ${{ runner.debug || false }} | |
run: | | |
tox -e ${{ matrix.toxenv }} | |
build: | |
runs-on: arc-runner | |
needs: test | |
permissions: | |
id-token: write | |
contents: read | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install build | |
run: python3.12 -m pip install --user build | |
- name: Build a binary wheel and a source tarball | |
run: python3.12 -m build --sdist --wheel --outdir dist/ . | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
file: .coverage | |
token: ${{ secrets.CODECOV_TOKEN }} |