Skip to content

Commit

Permalink
Merge pull request #45 from max-pfeiffer/feature/process_improvements
Browse files Browse the repository at this point in the history
Feature/process improvements
  • Loading branch information
max-pfeiffer authored Oct 10, 2023
2 parents a11ecc8 + afcd0cd commit 8e58b98
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
uses: crazy-max/ghaction-github-runtime@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
uses: crazy-max/ghaction-github-runtime@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -137,11 +137,17 @@ jobs:
- run-publish-image-tests
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download coverage reports from artifactory
uses: actions/download-artifact@v3
- name: Compile the relevant reports
run: |
ls -sal
find . -name "*.xml" -exec cp {} . \;
ls -sal
cat build_image_coverage_report.xml
cat publish_image_coverage_report.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -165,7 +171,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v2
uses: crazy-max/ghaction-github-runtime@v3
- name: Get Git Commit Tag Name
uses: olegtarasov/[email protected]
- name: Setup Python
Expand Down
1 change: 1 addition & 0 deletions build/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PLATFORMS: list[str] = ["linux/amd64", "linux/arm64/v8"]
13 changes: 7 additions & 6 deletions build/publish.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import click
from build.constants import PLATFORMS

from build.utils import get_context, get_image_reference
from pathlib import Path
Expand Down Expand Up @@ -61,14 +62,14 @@ def main(
image_reference: str = get_image_reference(
registry, version_tag, poetry_version, python_version, os_variant
)
cache_scope: str = f"{poetry_version}-{python_version}-{os_variant}"

platforms: list[str] = ["linux/amd64", "linux/arm64/v8"]
cache_to: str = "type=gha,mode=max"
cache_from: str = "type=gha"
cache_to: str = f"type=gha,mode=max,scope=$GITHUB_REF_NAME-{cache_scope}"
cache_from: str = f"type=gha,scope=$GITHUB_REF_NAME-{cache_scope}"

if use_local_cache_storage_backend:
cache_to = "type=local,mode=max,dest=/tmp"
cache_from = "type=local,src=/tmp"
cache_to = f"type=local,mode=max,dest=/tmp,scope={cache_scope}"
cache_from = f"type=local,src=/tmp,scope={cache_scope}"

docker_client: DockerClient = DockerClient()
builder: Builder = docker_client.buildx.create(
Expand All @@ -89,7 +90,7 @@ def main(
"OFFICIAL_PYTHON_IMAGE": f"python:{python_version}-{os_variant}",
},
tags=image_reference,
platforms=platforms,
platforms=PLATFORMS,
builder=builder,
cache_to=cache_to,
cache_from=cache_from,
Expand Down
8 changes: 3 additions & 5 deletions tests/build_image/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
from python_on_whales import Builder, DockerClient

from build.constants import PLATFORMS
from build.utils import get_image_reference
from tests.constants import CONTEXT, REGISTRY_PASSWORD, REGISTRY_USERNAME
from tests.registry_container import DockerRegistryContainer
Expand Down Expand Up @@ -44,11 +45,8 @@ def image_reference(
image_reference: str = get_image_reference(
registry, image_version, poetry_version, python_version, os_variant
)
cache_scope: str = (
f"{image_version}-{poetry_version}-{python_version}-{os_variant}"
)
cache_scope: str = f"{poetry_version}-{python_version}-{os_variant}"

platforms: list[str] = ["linux/amd64", "linux/arm64/v8"]
cache_to: str = f"type=gha,mode=max,scope=$GITHUB_REF_NAME-{cache_scope}"
cache_from: str = f"type=gha,scope=$GITHUB_REF_NAME-{cache_scope}"

Expand All @@ -64,7 +62,7 @@ def image_reference(
"OFFICIAL_PYTHON_IMAGE": f"python:{python_version}-{os_variant}",
},
tags=image_reference,
platforms=platforms,
platforms=PLATFORMS,
builder=pow_buildx_builder,
cache_to=cache_to,
cache_from=cache_from,
Expand Down

0 comments on commit 8e58b98

Please sign in to comment.