-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontend charm integration tests fix with a self hosted runner #54
Changes from 40 commits
0d44757
97e8d4c
a055701
672ea62
6c11eb5
5c149e2
11cf30b
6e8375a
97f1531
1478f45
b03e015
55b9436
cde6b80
1ed9d5f
0a30cee
bf2859c
2fc065f
06a258e
4af3b2a
0db5736
8417af7
a3a5404
e90849c
234b1aa
fd3ed35
63f4d6f
acf47ce
b03dddb
7348559
9521314
6a53221
bcd4cf5
08d8c5c
977550e
9f8ccec
422ee3b
4068f04
1b1e212
b0b420d
fb4817a
5a75762
4f5cc55
188f2ba
418cdbd
ff57b22
61e6d4f
9e0ff27
943e0e6
acb0dd8
f9528e3
3ded998
5bcbd1c
ad2ae8b
09e1425
e465185
4814f96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,27 @@ | ||
name: Run charm tests | ||
on: | ||
push: | ||
branches: ["main"] | ||
branches: ["main", "integration-test-fix*"] | ||
tags: ["v*.*.*"] | ||
|
||
jobs: | ||
integration-test: | ||
permissions: | ||
contents: read | ||
packages: read | ||
|
||
name: Integration tests | ||
runs-on: ubuntu-22.04 | ||
runs-on: [self-hosted, jammy, xlarge] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup LXD | ||
uses: canonical/setup-lxd@main | ||
with: | ||
channel: 5.13/stable | ||
- name: Setup operator environment | ||
uses: charmed-kubernetes/actions-operator@main | ||
with: | ||
provider: microk8s | ||
uses: actions/checkout@v4 | ||
- name: Set up microk8s | ||
uses: canonical/certification-github-workflows/.github/actions/microk8s-setup@microk8s-setup-action | ||
- name: Run integration tests | ||
run: tox -e integration | ||
- name: Archive Tested Charm | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ github.ref_name == 'main' }} | ||
with: | ||
name: tested-charm | ||
path: .tox/**/test-observer-frontend_ubuntu-22.04-amd64.charm | ||
retention-days: 5 | ||
- name: Archive charmcraft logs | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: charmcraft-logs | ||
path: /home/runner/.local/state/charmcraft/log/*.log | ||
- name: Archive juju crashdump | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: juju-crashdump | ||
path: juju-crashdump-*.tar.xz | ||
- name: Archive charm testing outputs | ||
uses: canonical/certification-github-workflows/.github/actions/archive-charm-testing-artifacts@microk8s-setup-action | ||
defaults: | ||
run: | ||
working-directory: ./frontend/charm | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Promote Charm | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
promotion: | ||
type: choice | ||
description: Channel to promote from | ||
options: | ||
- edge -> beta | ||
- beta -> candidate | ||
- candidate -> stable | ||
|
||
jobs: | ||
promote: | ||
name: Promote Charm | ||
runs-on: [self-hosted, linux] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set target channel | ||
env: | ||
PROMOTE_FROM: ${{ github.event.inputs.promotion }} | ||
run: | | ||
if [ "${PROMOTE_FROM}" == "edge -> beta" ]; then | ||
echo "promote-from=edge" >> ${GITHUB_ENV} | ||
echo "promote-to=beta" >> ${GITHUB_ENV} | ||
elif [ "${PROMOTE_FROM}" == "beta -> candidate" ]; then | ||
echo "promote-from=beta" >> ${GITHUB_ENV} | ||
echo "promote-to=candidate" >> ${GITHUB_ENV} | ||
elif [ "${PROMOTE_FROM}" == "candidate -> stable" ]; then | ||
echo "promote-from=candidate" >> ${GITHUB_ENV} | ||
echo "promote-to=stable" >> ${GITHUB_ENV} | ||
fi | ||
- name: Promote Charm | ||
uses: canonical/charming-actions/[email protected] | ||
with: | ||
base-channel: 22.04 | ||
credentials: ${{ secrets.CHARMHUB_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
destination-channel: latest/${{ env.promote-to }} | ||
origin-channel: latest/${{ env.promote-from }} | ||
charmcraft-channel: latest/stable |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Run charm tests | ||
on: | ||
push: | ||
branches: ["main"] | ||
tags: ["v*.*.*"] | ||
|
||
jobs: | ||
publish-charm: | ||
name: Publish Charm | ||
needs: integration-test | ||
runs-on: [self-hosted, linux] | ||
if: ${{ github.ref_name == 'main' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install charmcraft | ||
run: sudo snap install charmcraft --classic | ||
- name: Fetch Tested Charm | ||
mz2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: actions/download-artifact@v3 | ||
with: | ||
name: tested-charm | ||
- name: Move charm in current directory | ||
run: find ./ -name test-observer-frontend_ubuntu-22.04-amd64.charm -exec mv -t ./ {} \; | ||
- name: Select Charmhub channel | ||
uses: canonical/charming-actions/[email protected] | ||
id: channel | ||
- name: Upload charm to Charmhub | ||
uses: canonical/charming-actions/[email protected] | ||
with: | ||
credentials: "${{ secrets.CHARMHUB_AUTH_API }}" | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
channel: "${{ steps.channel.outputs.name }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
on: | ||
# pull_request: | ||
# branches: | ||
# - main | ||
push: | ||
branches: ["a-branch-that-definitely-does-not-exist"] | ||
# tags: ["v*.*.*"] | ||
|
||
jobs: | ||
build: | ||
name: Release test-observer-api charm to edge | ||
runs-on: [self-hosted, linux] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
#- name: Select charmhub channel | ||
# uses: canonical/charming-actions/[email protected] | ||
# id: channel | ||
- name: Upload charm to charmhub | ||
uses: canonical/charming-actions/[email protected] | ||
with: | ||
charm-path: "backend/charm" | ||
credentials: "${{ secrets.CHARMHUB_AUTH_API }}" | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
upload-image: "true" | ||
channel: edge # "${{ steps.channel.outputs.name }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ops >= 1.5.0 | ||
ops >= 2.8.0 | ||
requests==2.31.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
ops >= 2.2.0 | ||
ops >= 2.8.0 | ||
macaroonbakery==1.3.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ commands = | |
description = Run integration tests | ||
deps = | ||
pytest | ||
juju | ||
juju<=3.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentionally |
||
pytest-operator | ||
-r {tox_root}/requirements.txt | ||
commands = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setup steps turned out to be more extensive on self hosted runners, and since this is all repetitive boilerplate that becomes relevant again when we want to integration test any other charmed part of our stack, I moved the whole lot to a reusable composite action. Same story below re: the
archive-charm-testing-artifacts