Skip to content

Further optimized DockerRegistryContainer #154

Further optimized DockerRegistryContainer

Further optimized DockerRegistryContainer #154

Workflow file for this run

name: Pipeline
on: push
jobs:
code-quality:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Run pylint and black
run: |
source .venv/bin/activate
pylint build tests
black --check .
run-build-image-tests:
needs: code-quality
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python_version: ["3.9.18", "3.10.13", "3.11.5"]
os_variant: ["bookworm", "slim-bookworm"]
poetry_version: ["1.4.2", "1.5.1", "1.6.1"]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Run tests for image builds with pytest
env:
PYTHON_VERSION: ${{ matrix.python_version }}
OS_VARIANT: ${{ matrix.os_variant }}
POETRY_VERSION: ${{ matrix.poetry_version }}
run: |
source .venv/bin/activate
pytest tests/build_image --cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
run-publish-image-tests:
needs: code-quality
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python_version: ["3.9.18", "3.10.13", "3.11.5"]
os_variant: ["bookworm", "slim-bookworm"]
poetry_version: ["1.4.2", "1.5.1", "1.6.1"]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Run tests for image publishing with pytest
env:
PYTHON_VERSION: ${{ matrix.python_version }}
OS_VARIANT: ${{ matrix.os_variant }}
POETRY_VERSION: ${{ matrix.poetry_version }}
run: |
source .venv/bin/activate
pytest tests/publish_image --cov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
publish-all-images:
needs:
- run-build-image-tests
- run-publish-image-tests
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python_version: ["3.9.18", "3.10.13", "3.11.5"]
os_variant: ["bookworm", "slim-bookworm"]
poetry_version: ["1.4.2", "1.5.1", "1.6.1"]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Get Git Commit Tag Name
uses: olegtarasov/[email protected]
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Publish Images to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
PYTHON_VERSION: ${{ matrix.python_version }}
OS_VARIANT: ${{ matrix.os_variant }}
POETRY_VERSION: ${{ matrix.poetry_version }}
run: |
source .venv/bin/activate
python -m build.publish