generated from canonical/template-operator
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7849247
commit 797e606
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,3 +72,55 @@ jobs: | |
uses: canonical/data-platform-workflows/.github/workflows/[email protected] | ||
with: | ||
charmcraft-snap-channel: latest/candidate # TODO: remove after charmcraft 3.3 stable release | ||
|
||
collect-integration-tests: | ||
name: Collect integration test spread jobs | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up environment | ||
run: sudo snap install charmcraft --classic --channel latest/candidate | ||
- name: Collect spread jobs | ||
id: collect-jobs | ||
shell: python | ||
run: | | ||
import json | ||
import os | ||
import subprocess | ||
jobs = ( | ||
subprocess.run( | ||
["charmcraft", "test", "--list", "github-ci"], capture_output=True, check=True, text=True | ||
) | ||
.stdout.strip() | ||
.split("\n") | ||
) | ||
output = f"jobs={json.dumps(jobs)}" | ||
print(output) | ||
with open(os.environ["GITHUB_OUTPUT"], "a") as file: | ||
file.write(output) | ||
outputs: | ||
jobs: ${{ steps.collect-jobs.outputs.jobs }} | ||
|
||
integration-test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
spread-job: ${{ fromJSON(needs.collect-integration-tests.outputs.jobs) }} | ||
name: Spread ${{ matrix.spread-job }} | ||
needs: | ||
- collect-integration-tests | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 200 # TODO | ||
steps: | ||
- name: Checkout | ||
timeout-minutes: 3 | ||
uses: actions/checkout@v4 | ||
- name: Set up environment | ||
timeout-minutes: 5 | ||
run: sudo snap install charmcraft --classic --channel latest/candidate | ||
- name: Run spread job | ||
timeout-minutes: 120 | ||
run: charmcraft test '${{ matrix.spread-job }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
project: mysql-router-k8s-operator | ||
|
||
backends: | ||
github-ci: | ||
type: adhoc | ||
# Only run on CI | ||
manual: true | ||
# HACK: spread requires runners to be accessible via SSH | ||
# Configure local sshd & instruct spread to connect to the same machine spread is running on | ||
# (spread cannot provision GitHub Actions runners, so we provision a GitHub Actions runner for | ||
# each spread job & select a single job when running spread) | ||
# Derived from https://github.com/jnsgruk/zinc-k8s-operator/blob/e2371961e0c18a21fc7bdbd0a7046a3550ce8538/spread.yaml#L47 | ||
allocate: | | ||
sudo tee /etc/ssh/sshd_config.d/10-spread-github-ci.conf << 'EOF' | ||
PasswordAuthentication yes | ||
PermitEmptyPasswords yes | ||
EOF | ||
ADDRESS localhost | ||
systems: | ||
- ubuntu-latest: | ||
username: runner | ||
|
||
suites: | ||
tests/spread/: | ||
summary: Spread tests | ||
|
||
path: /remote/path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
summary: foo | ||
execute: | | ||
echo "Hello world!" | ||
exit 1 |