-
Notifications
You must be signed in to change notification settings - Fork 76
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
ci(docs): spread test documentation #2126
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Spread tests for docs | ||
on: | ||
pull_request: | ||
paths: | ||
- spread.yaml | ||
- docs/**/code/** | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- spread.yaml | ||
- docs/**/code/** | ||
schedule: | ||
- cron: "0 0 * * 0" # Midnight UTC on Sundays | ||
|
||
jobs: | ||
docs-tests: | ||
runs-on: spread-installed | ||
steps: | ||
- name: Cleanup job workspace | ||
run: | | ||
rm -rf "${{ github.workspace }}" | ||
mkdir "${{ github.workspace }}" | ||
|
||
- name: Checkout charmcraft | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: true | ||
|
||
- name: Download snap from store | ||
run: | | ||
snap download --edge charmcraft | ||
|
||
- name: Run spread | ||
run: | | ||
spread google:docs/howto/code/ google:docs/tutorial/code/ | ||
|
||
- name: Discard spread workers | ||
if: always() | ||
run: | | ||
shopt -s nullglob | ||
for r in .spread-reuse.*.yaml; do | ||
spread -discard -reuse-pid="$(echo "$r" | grep -o -E '[0-9]+')" | ||
done |
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 |
---|---|---|
|
@@ -11,6 +11,10 @@ kill-timeout: 90m | |
|
||
environment: | ||
|
||
prepare: | | ||
juju destroy-model flask-async-app --destroy-storage --no-prompt --force || true | ||
juju destroy-controller --force --destroy-all-models --destroy-storage --no-prompt --no-wait dev-controller || true | ||
|
||
execute: | | ||
# Move everything to $HOME so that Juju deployment works | ||
mv *.yaml *.py *.txt $HOME | ||
|
@@ -89,8 +93,6 @@ execute: | | |
charmcraft init --profile flask-framework --name flask-async-app | ||
# [docs:charm-init-end] | ||
|
||
sed -i "s/paas-charm.*/https:\/\/github.com\/canonical\/paas-charm\/archive\/async-workers.tar.gz/g" requirements.txt | ||
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. how come? 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. The file no longer exists so that line was causing the spread test to fail. |
||
|
||
# [docs:charm-pack] | ||
charmcraft pack | ||
# [docs:charm-pack-end] | ||
|
@@ -160,7 +162,8 @@ execute: | | |
end_time=$(date +%s) | ||
overall_passtime=$((end_time - overall_start_time)) | ||
echo "Total pass time: $overall_passtime" | ||
if [ $((3 < overall_passtime)) -eq 1 ]; then | ||
# If this takes more than 60 seconds we probably have an issue. | ||
if [ $((60 < overall_passtime)) -eq 1 ]; then | ||
echo "Error!" | ||
ASYNC_RESULT='FALSE' | ||
exit 2 | ||
|
@@ -176,7 +179,14 @@ execute: | | |
rm -rf charm .venv __pycache__ | ||
# delete all the files created during the tutorial | ||
rm flask-async-app_0.1_$(dpkg --print-architecture).rock rockcraft.yaml app.py \ | ||
requirements.txt migrate.py | ||
requirements.txt | ||
# Remove the juju model | ||
juju destroy-model flask-async-app --destroy-storage --no-prompt --force | ||
# [docs:clean-environment-end] | ||
|
||
restore: | | ||
# Destroy the model on restore just in case the test failed. | ||
juju destroy-model flask-async-app --destroy-storage --no-prompt --force || true | ||
|
||
# Destroy the controller | ||
juju destroy-controller --force --destroy-all-models --destroy-storage --no-prompt --no-wait dev-controller || true |
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm afraid we'll eventually reach a point where the doc tests need the PR's version of charmcraft, which will make this quite hard to debug
I don't really know how to fix this though, short of packing the snap again here (for the 4th or so time probably)
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.
I agree, but I'm kicking that can down the road for now because it's something I'd like to eventually solve with a workflow that starts by building the snap and then conditionally kicks off every job that consumes the snap, ideally using Starflow to do this for all our apps.