Skip to content

Commit

Permalink
Use single (cached) build for tests & release (#182)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
carlcsaposs-canonical authored Jan 17, 2025
1 parent 8f9bcde commit 93e4b0f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,16 @@ jobs:
- lib-check
uses: ./.github/workflows/ci.yaml

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
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/[email protected]
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
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:
Expand Down
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 93e4b0f

Please sign in to comment.