From 93e4b0fcd76c19b0689b1d458b51a410ef938dcb Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Fri, 17 Jan 2025 10:35:46 +0000 Subject: [PATCH] Use single (cached) build for tests & release (#182) Use the same build for integration tests & release, so that we release what we tested Use charmcraftcache for the build Signed by Mykola & Jon: https://docs.google.com/document/d/1Wt0ds4dEcih4cvHWkbvvALtqonC_D9crcNQteX34SUg/edit --- .github/workflows/ci.yaml | 15 +++++++++------ .github/workflows/release.yaml | 11 ++--------- poetry.lock | 10 +++++----- pyproject.toml | 4 ++-- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e945f673..bb1327f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,9 +9,13 @@ concurrency: on: pull_request: schedule: - - cron: "53 0 * * *" # Daily at 00:53 UTC + - cron: '53 0 * * *' # Daily at 00:53 UTC # Triggered on push to branch "main" by .github/workflows/release.yaml workflow_call: + outputs: + artifact-prefix: + description: build_charm.yaml `artifact-prefix` output + value: ${{ jobs.build.outputs.artifact-prefix }} jobs: lint: @@ -40,9 +44,8 @@ jobs: build: name: Build charms - uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v26.0.0 + uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v29.0.0 with: - cache: true charmcraft-snap-channel: latest/candidate # TODO: remove after charmcraft 3.3 stable release path-to-charm-directory: ${{ matrix.path }} strategy: @@ -82,7 +85,7 @@ jobs: - name: Download packed charm(s) uses: actions/download-artifact@v4 with: - pattern: packed-charm-cache-true-* + pattern: ${{ needs.build.outputs.artifact-prefix }}-* merge-multiple: True - name: Select tests id: select-tests @@ -126,7 +129,7 @@ jobs: - name: Download packed charm(s) uses: actions/download-artifact@v4 with: - pattern: packed-charm-cache-true-* + pattern: ${{ needs.build.outputs.artifact-prefix }}-* merge-multiple: true - name: Select tests id: select-tests @@ -172,7 +175,7 @@ jobs: - name: Download packed charm(s) uses: actions/download-artifact@v4 with: - pattern: packed-charm-cache-true-* + pattern: ${{ needs.build.outputs.artifact-prefix }}-* merge-multiple: true - name: Select tests id: select-tests diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 600c3dd8..f19d3cf1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -29,23 +29,16 @@ jobs: - lib-check uses: ./.github/workflows/ci.yaml - build: - name: Build charm - uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v26.0.0 - with: - charmcraft-snap-channel: latest/candidate # TODO: remove after charmcraft 3.3 stable release - release: name: Release to Charmhub needs: - lib-check - ci-tests - - build - uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v26.0.0 + uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v29.0.0 with: charmcraft-snap-channel: latest/candidate # TODO: remove after charmcraft 3.3 stable release channel: 3/edge - artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} + artifact-prefix: ${{ needs.ci-tests.outputs.artifact-prefix }} secrets: charmhub-token: ${{ secrets.CHARMHUB_TOKEN }} permissions: diff --git a/poetry.lock b/poetry.lock index 34b4a1b9..dd3ee3c9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2179,8 +2179,8 @@ pytest = "*" [package.source] type = "git" url = "https://github.com/canonical/data-platform-workflows" -reference = "v26.0.0" -resolved_reference = "92d0a9f28a22c57b5965866c22f65b5021d3b115" +reference = "v29.0.0" +resolved_reference = "90077c956fd22995aec4c1e5b86cf6248717d8c7" subdirectory = "python/pytest_plugins/microceph" [[package]] @@ -2237,8 +2237,8 @@ pyyaml = "*" [package.source] type = "git" url = "https://github.com/canonical/data-platform-workflows" -reference = "v26.0.0" -resolved_reference = "92d0a9f28a22c57b5965866c22f65b5021d3b115" +reference = "v29.0.0" +resolved_reference = "90077c956fd22995aec4c1e5b86cf6248717d8c7" subdirectory = "python/pytest_plugins/pytest_operator_cache" [[package]] @@ -2911,4 +2911,4 @@ files = [ [metadata] lock-version = "2.1" python-versions = "^3.10" -content-hash = "099eb316bf95048a60a9b1cd11352e9c4a7e55825be36b31e15eec4881c2b788" +content-hash = "867e0721f5ef83c287173f14e043cec844810c975619f1df0b3997dc726fcd5d" diff --git a/pyproject.toml b/pyproject.toml index f2dd8032..679cdfe6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,10 +90,10 @@ pytest = ">=7.2" juju = "^3.6.0" coverage = { extras = ["toml"], version = ">7.0" } pytest-operator = ">0.20" -pytest-operator-cache = { git = "https://github.com/canonical/data-platform-workflows", tag = "v26.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache" } +pytest-operator-cache = { git = "https://github.com/canonical/data-platform-workflows", tag = "v29.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache" } # To be enabled if we are using groups on integration tests # pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v6.1.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"} -pytest-microceph = { git = "https://github.com/canonical/data-platform-workflows", tag = "v26.0.0", subdirectory = "python/pytest_plugins/microceph" } +pytest-microceph = { git = "https://github.com/canonical/data-platform-workflows", tag = "v29.0.0", subdirectory = "python/pytest_plugins/microceph" } [tool.ruff] line-length = 99