From 3f1b23072e61b7cab094e54dada4e54ec671fe6a Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Fri, 17 Jan 2025 10:36:23 +0000 Subject: [PATCH] Use single (cached) build for tests & release (#538) 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 | 18 +++++++++--------- pyproject.toml | 8 ++++---- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f1c577604..9eb8a6f54 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,14 +9,18 @@ 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: name: Lint - uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v26.0.0 + uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v29.0.0 unit-test: name: Unit test charm @@ -141,9 +145,8 @@ jobs: - tests/integration/sharding_tests/application - tests/integration/relation_tests/new_relations/application-charm name: Build charm - 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 }} @@ -153,9 +156,9 @@ jobs: - lint - unit-test - build - uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v26.0.0 + uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v29.0.0 with: - artifact-prefix: packed-charm-cache-true + artifact-prefix: ${{ needs.build.outputs.artifact-prefix }} cloud: lxd juju-agent-version: 3.6.1 # renovate: juju-agent-pin-minor _beta_allure_report: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 33ec80939..518c1c59d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,22 +12,15 @@ jobs: permissions: contents: write # Needed for Allure Report beta - 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-charm: name: Release charm needs: - 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: 6/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 919895504..0e71bccec 100644 --- a/poetry.lock +++ b/poetry.lock @@ -33,8 +33,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/allure_pytest_collection_report" [[package]] @@ -1797,8 +1797,8 @@ develop = false [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/github_secrets" [[package]] @@ -1855,8 +1855,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]] @@ -1875,8 +1875,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/pytest_operator_groups" [[package]] @@ -2466,4 +2466,4 @@ files = [ [metadata] lock-version = "2.1" python-versions = "^3.10.12" -content-hash = "c18a222305bbe428c8e75354b60bcdd2e5ce62b1a3fe2b9b3d635cf06da26c38" +content-hash = "5deca6cb1df114a8f532bc1a3f617272de1baf90687853f1223391a53947e375" diff --git a/pyproject.toml b/pyproject.toml index cfe258406..1dbd8fdda 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,10 +67,10 @@ pytest = "^8.1.1" pytest-asyncio = "^0.21.1" pytest-mock = "^3.14.0" pytest-operator = "^0.36.0" -pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v26.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"} -pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v26.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"} -pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v26.0.0", subdirectory = "python/pytest_plugins/github_secrets"} -allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v26.0.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"} +pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v29.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"} +pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v29.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"} +pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v29.0.0", subdirectory = "python/pytest_plugins/github_secrets"} +allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v29.0.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"} [build-system] build-backend = "poetry.core.masonry.api"