Skip to content

Commit 5a21d70

Browse files
authored
[DPE-3064] reusable workflow (#338)
* Bump actions * Adding marks * Relative imports * Switch to reusable workflow * Add markers * Skip password tests on juju * Remove deps * Borked import * Bump workflow * Missing import
1 parent 31ca568 commit 5a21d70

26 files changed

+185
-388
lines changed

.github/workflows/ci.yaml

Lines changed: 23 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
jobs:
2323
lint:
2424
name: Lint
25-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
25+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].3
2626

2727
unit-test:
2828
name: Unit test charm
@@ -45,83 +45,35 @@ jobs:
4545

4646
build:
4747
name: Build charm
48-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
48+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].3
4949
permissions:
5050
actions: write # Needed to manage GitHub Actions cache
5151

52-
gh-hosted-integration-test:
52+
integration-test:
5353
strategy:
5454
fail-fast: false
5555
matrix:
56-
tox-environment:
57-
- backup-integration
58-
- charm-integration
59-
- database-relation-integration
60-
- db-relation-integration
61-
- db-admin-relation-integration
62-
- ha-replication-integration
63-
- ha-self-healing-integration
64-
- password-rotation-integration
65-
- plugins-integration
66-
- tls-integration
67-
- upgrade-integration
68-
- upgrade-from-stable-integration
69-
juju-snap-channel: ["2.9/stable", "3.1/stable"]
70-
include:
71-
- juju-snap-channel: "3.1/stable"
72-
agent-version: "3.1.6"
73-
libjuju-version: "3.2.2"
74-
exclude-mark: "juju2"
75-
- juju-snap-channel: "2.9/stable"
76-
agent-version: "2.9.45"
77-
libjuju-version: "2.9.45.0"
78-
exclude-mark: "juju3"
79-
name: ${{ matrix.juju-snap-channel }} - (GH hosted) ${{ matrix.tox-environment }}
56+
juju:
57+
- agent: 2.9.45
58+
libjuju: ^2
59+
- agent: 3.1.6
60+
name: Integration test charm | ${{ matrix.juju.agent }}
8061
needs:
8162
- lint
8263
- unit-test
8364
- build
84-
runs-on: ubuntu-latest
85-
timeout-minutes: 120
86-
steps:
87-
- name: Checkout
88-
uses: actions/checkout@v4
89-
- name: Install tox & poetry
90-
run: |
91-
pipx install tox
92-
pipx install poetry
93-
- name: Setup operator environment
94-
uses: charmed-kubernetes/actions-operator@main
95-
with:
96-
provider: microk8s
97-
channel: "1.28-strict/stable"
98-
bootstrap-options: "--agent-version ${{ matrix.agent-version }}"
99-
juju-channel: ${{ matrix.juju-snap-channel }}
100-
- name: Update python-libjuju version
101-
if: ${{ matrix.juju-snap-channel == '2.9/stable' }}
102-
run: poetry add --lock --group integration juju@'${{ matrix.libjuju-version }}'
103-
- name: Download packed charm(s)
104-
uses: actions/download-artifact@v3
105-
with:
106-
name: ${{ needs.build.outputs.artifact-name }}
107-
- name: Select test stability level
108-
id: select-test-stability
109-
run: |
110-
if [[ "${{ github.event_name }}" == "schedule" ]]
111-
then
112-
echo Running unstable and stable tests
113-
echo "mark_expression=" >> "$GITHUB_OUTPUT"
114-
else
115-
echo Skipping unstable tests
116-
echo "mark_expression=and not unstable" >> "$GITHUB_OUTPUT"
117-
fi
118-
- name: Run integration tests
119-
run: tox run -e ${{ matrix.tox-environment }} -- -m 'not ${{ matrix.exclude-mark }} ${{ steps.select-test-stability.outputs.mark_expression }}' --keep-models
120-
env:
121-
SECRETS_FROM_GITHUB: |
122-
{
123-
"AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
124-
"AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}",
125-
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
126-
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
127-
}
65+
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
66+
with:
67+
artifact-name: ${{ needs.build.outputs.artifact-name }}
68+
cloud: microk8s
69+
microk8s-snap-channel: 1.28-strict/stable
70+
juju-agent-version: ${{ matrix.juju.agent }}
71+
libjuju-version-constraint: ${{ matrix.juju.libjuju }}
72+
secrets:
73+
integration-test: |
74+
{
75+
"AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
76+
"AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}",
77+
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
78+
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
79+
}

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ jobs:
4141

4242
build:
4343
name: Build charm
44-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
44+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].3
4545

4646
release:
4747
name: Release charm
4848
needs:
4949
- ci-tests
5050
- build
51-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
51+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].3
5252
with:
5353
channel: 14/edge
5454
artifact-name: ${{ needs.build.outputs.artifact-name }}

.github/workflows/sync_issue_to_jira.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
sync:
1111
name: Sync GitHub issue to Jira
12-
uses: canonical/data-platform-workflows/.github/workflows/[email protected].1
12+
uses: canonical/data-platform-workflows/.github/workflows/[email protected].3
1313
with:
1414
jira-base-url: https://warthogs.atlassian.net
1515
jira-project-key: DPE

poetry.lock

Lines changed: 7 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,14 @@ optional = true
7070
[tool.poetry.group.integration.dependencies]
7171
lightkube = "^0.15.0"
7272
pytest = "^7.4.3"
73-
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v6.3.1", subdirectory = "python/pytest_plugins/github_secrets"}
73+
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v6.3.3", subdirectory = "python/pytest_plugins/github_secrets"}
7474
pytest-operator = "^0.31.0"
75-
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v6.3.1", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
76-
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v6.3.1", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
75+
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v6.3.3", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
76+
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v6.3.3", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
7777
juju = "^3.2.2"
7878
psycopg2 = {version = "^2.9.9", extras = ["binary"]}
7979
boto3 = "^1.33.1"
8080
tenacity = "^8.2.3"
81-
ops = "^2.8.0"
82-
pytest-mock = "^3.12.0"
8381

8482
[build-system]
8583
requires = ["poetry-core>=1.0.0"]
@@ -96,7 +94,7 @@ show_missing = true
9694
minversion = "6.0"
9795
log_cli_level = "INFO"
9896
asyncio_mode = "auto"
99-
markers = ["unstable"]
97+
markers = ["unstable", "juju2", "juju3", "juju_secrets"]
10098

10199
# Formatting tools configuration
102100
[tool.black]

tests/integration/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Copyright 2023 Canonical Ltd.
2+
# See LICENSE file for licensing details.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Copyright 2023 Canonical Ltd.
2+
# See LICENSE file for licensing details.

tests/integration/ha_tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from pytest_operator.plugin import OpsTest
77
from tenacity import Retrying, stop_after_delay, wait_fixed
88

9-
from tests.integration.ha_tests.helpers import (
9+
from ..helpers import app_name
10+
from .helpers import (
1011
APPLICATION_NAME,
1112
change_patroni_setting,
1213
change_wal_settings,
@@ -17,7 +18,6 @@
1718
modify_pebble_restart_delay,
1819
remove_instance_isolation,
1920
)
20-
from tests.integration.helpers import app_name
2121

2222

2323
@pytest.fixture()

tests/integration/ha_tests/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
wait_fixed,
2828
)
2929

30-
from tests.integration.helpers import (
30+
from ..helpers import (
3131
APPLICATION_NAME,
3232
app_name,
3333
db_connect,

0 commit comments

Comments
 (0)