Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ on:
required: false
type: string
default: "src"
docker-container:
description: "Docker container to run as part of build"
required: false
type: string
docker-compose-env:
description: "env to set for docker compose as a JSON string"
required: false
type: string
default: ""
python-versions-to-test:
description: "List of versions of python to run, as a JSON string"
required: false
type: string
default: "['3.10']"
secrets:
LC_URL:
required: false
Expand Down Expand Up @@ -123,13 +137,20 @@ jobs:
build-and-test:
runs-on: ubuntu-latest
needs: [check-for-leaks, run-checks]
container: python:3.10
strategy:
matrix:
python-version: ${{ fromJSON(inputs.python-versions-to-test) }}
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Install dependencies
run: |
pip install tox
Expand All @@ -140,9 +161,23 @@ jobs:
git config --global --add safe.directory /__w/$dname/$dname
shell: sh

- name: Login to Docker Hub
if: inputs.docker-container != ''
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CI_GITHUB_TOKEN }}

- name: Stand up required service containers, and run code generation
if: inputs.docker-container != ''
env: ${{ fromJSON(inputs.docker-compose-env }}
run: |
docker compose up ${{ inputs.docker-container }}

- name: Build and test
run: |
tox
tox -e py${{ matrix.python-version }}
shell: bash

- name: Upload coverage to Codecov
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/python-lib-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ on:
required: false
type: string
default: "src"
docker-container:
description: "Docker container to run as part of build"
required: false
type: string
docker-compose-env:
description: "env to set for docker compose as a JSON string"
required: false
type: string
default: ""
python-version:
description: "Python versions to run 'build'"
required: false
type: string
default: 3.10

secrets:
CI_GITHUB_TOKEN:
Expand Down Expand Up @@ -143,7 +157,7 @@ jobs:
python-deps-check:
needs: release-checks
runs-on: ubuntu-latest
container: python:3.10
container: python:${{ inputs.python-version }}
steps:
- uses: actions/checkout@v4

Expand All @@ -166,7 +180,7 @@ jobs:
needs: [release-checks, build-docs]
if: always() && !failure() && !cancelled()
runs-on: ubuntu-latest
container: python:3.10
container: python:${{ inputs.python-version }}
outputs:
artifact: ${{ steps.build.outputs.artifact }}
steps:
Expand Down Expand Up @@ -198,10 +212,24 @@ jobs:
echo "password = $PYPI_API_TOKEN" >> ~/.pypirc
echo "\n" >> ~/.pypirc

- name: Login to Docker Hub
if: inputs.docker-container != ''
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CI_GITHUB_TOKEN }}

- name: Stand up required service containers, and run code generation
if: inputs.docker-container != ''
env: ${{ fromJSON(inputs.docker-compose-env }}
run: |
docker compose up ${{ inputs.docker-container }}

- name: Build and publish
id: build
run: |
tox
tox -e py${{ inputs.python-version }}
twine upload --non-interactive --config-file ~/.pypirc dist/*
artifact_id=$(cat pyproject.toml | grep '[[:space:]]*name[[:space:]]*=[[:space:]]*".*"$' | cut -d\" -f2 | tr -d '"' | sed 's-\.-_-g')
artifact="${artifact_id}-${{ needs.release-checks.outputs.version }}-py3-none-any.whl"
Expand Down
26 changes: 24 additions & 2 deletions .github/workflows/python-lib-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ on:
required: false
type: string
default: "src"
docker-container:
description: "Docker container to run as part of build"
required: false
type: string
python-version:
description: "Python versions to run 'build'"
required: false
type: string
default: 3.10
#pypi-project-name: # OPS-185, although this could be replaced by parsing the name from .pyproject.toml?
# description: 'The Pypi project to deploy to - should be the package name'
# required: true
Expand Down Expand Up @@ -98,7 +107,7 @@ jobs:

deploy:
runs-on: ubuntu-latest
container: python:3.10
container: python:${{ inputs.python-version }}
needs: [run-checks]
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
Expand Down Expand Up @@ -128,11 +137,24 @@ jobs:
echo "password = $PYPI_API_TOKEN" >> ~/.pypirc
echo "\n" >> ~/.pypirc

- name: Login to Docker Hub
if: inputs.docker-container != ''
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CI_GITHUB_TOKEN }}

- name: Stand up required service containers, and run code generation
if: inputs.docker-container != ''
run: |
docker compose up ${{ inputs.docker-container }}

- name: Build and publish
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
tox
tox -e py${{ inputs.python-version }}
twine upload --verbose --non-interactive --config-file ~/.pypirc dist/*
shell: bash

Expand Down