Skip to content

Commit

Permalink
Configured matrix for image publishing, removed clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
max-pfeiffer committed Sep 23, 2023
1 parent b71fac3 commit f2ef1c6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 78 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
poetry_version: ["1.4.2", "1.5.1", "1.6.1"]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Setup Python
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
poetry_version: ["1.6.1"]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Setup Python
Expand Down Expand Up @@ -133,9 +133,15 @@ jobs:
- 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@v3
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
- name: Get Git Commit Tag Name
Expand All @@ -159,10 +165,13 @@ jobs:
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root
- name: Publish Image to Docker Hub
- 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
40 changes: 0 additions & 40 deletions build/docker-bake.hcl

This file was deleted.

Empty file added tests/publish_image/__init__.py
Empty file.
2 changes: 0 additions & 2 deletions tests/test.txt

This file was deleted.

31 changes: 0 additions & 31 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,3 @@ def create_from_reference(cls, tag: str):
poetry_version=poetry_version,
python_version=python_version,
)


def create_version_tag_for_example_images(version: str, target: str) -> str:
version_tag: str = f"{version}-{target}"
return version_tag


def extract_image_references_from_build_config(build_config: dict) -> list[str]:
image_tags: list[str] = []
targets: dict = build_config["target"]
for value in targets.values():
image_tags.extend(value["tags"])
return image_tags


def generate_image_references(
bake_file: Path, context: Path, version: str
) -> list[str]:
pow_docker_client: DockerClient = DockerClient()
build_config: dict = pow_docker_client.buildx.bake(
targets=["python-poetry"],
files=[bake_file],
variables=dict(
REGISTRY="localhost:5000",
CONTEXT=str(context),
IMAGE_VERSION=version,
),
print=True,
)
images_tags = extract_image_references_from_build_config(build_config)
return images_tags

0 comments on commit f2ef1c6

Please sign in to comment.