Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion .github/workflows/self-test-qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
slow-test-platforms: '["ubuntu-latest"]'
slow-test-python-versions: '["3.14"]'
lowest-python-version: "3.8"
lowest-python-platform: '["jammy", "arm64"]'
lowest-python-platform: '["focal", "amd64"]'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by: test that we work on Canonical's focal runners :-)

use-lxd: true
Comment thread
lengau marked this conversation as resolved.
pytest-markers: smoketest and not steamtest
setup-vars: SETUP_EXTRA=1
Expand All @@ -32,10 +32,55 @@ jobs:
with:
# Test on many OS's to ensure that these workflows work everywhere.
# Also ensure we can add a list of tags for self-hosted runners.
# Intentionally overlaps with test-python-custom to verify that
# coverage artifact names are unique across callers (the reusable
# workflow includes the caller job identifier in the artifact name
# to prevent 409 Conflict errors).
fast-test-platforms: '["ubuntu-latest"]'
fast-test-python-versions: '["3.14"]'
slow-test-platforms: '["ubuntu-latest"]'
slow-test-python-versions: '["3.14"]'
lowest-python-version: "3.8"
lowest-python-platform: "ubuntu-latest"
test-command-prefix: sudo # Test that we can run with sudo.
verify-coverage-artifacts:
name: Verify coverage artifacts
if: ${{ !cancelled() }}
needs: [test-python, test-python-custom, test-python-as-root]
runs-on: ubuntu-latest
steps:
- name: Verify coverage artifacts are unique and present
env:
GH_TOKEN: ${{ github.token }}
run: |
artifacts=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" \
--paginate --jq '.artifacts[].name')
coverage=$(echo "$artifacts" | grep '^coverage-' | sort)

echo "=== Coverage artifacts ==="
echo "$coverage"
echo ""

# Verify no duplicate artifact names
dupes=$(echo "$coverage" | uniq -d)
if [ -n "$dupes" ]; then
echo "::error::Duplicate coverage artifact names:"
echo "$dupes"
exit 1
fi

exit_code=0

# Verify each caller job produced fast, slow, and lowest artifacts
for job in test-python test-python-custom test-python-as-root; do
for type in fast slow lowest; do
if ! echo "$coverage" | grep -q "^coverage-${job}-${type}-"; then
echo "::error::Missing coverage-${job}-${type}-* artifact"
exit_code=1
fi
done
done

total=$(printf %s "$coverage" | grep -c .)
echo "Total: ${total} unique coverage artifacts"
exit $exit_code
36 changes: 33 additions & 3 deletions .github/workflows/test-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,20 @@ jobs:
echo "::endgroup::"
done
exit $exit_code
- name: Resolve caller job name
id: ctx
if: ${{ !cancelled() }}
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
name=$(gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${{ job.check_run_id }}" --jq '.name')
caller="${name%% / *}"
echo "caller-job=${caller}" >> "$GITHUB_OUTPUT"
Comment thread
lengau marked this conversation as resolved.
- name: Upload test coverage
uses: actions/upload-artifact@v7
with:
name: coverage-fast-${{ join(matrix.platform, '-') }}
name: coverage-${{ steps.ctx.outputs.caller-job }}-fast-${{ join(matrix.platform, '-') }}
overwrite: true
path: |
./coverage.xml
Expand All @@ -114,10 +124,20 @@ jobs:
MARKERS: ${{ inputs.pytest-markers }}
run: |
${{ inputs.test-command-prefix }} make test-coverage PYTEST_ADDOPTS="--no-header -v -rN -m 'slow ${MARKERS:+and ($MARKERS)}'"
- name: Resolve caller job name
id: ctx
if: ${{ !cancelled() }}
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
name=$(gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${{ job.check_run_id }}" --jq '.name')
caller="${name%% / *}"
echo "caller-job=${caller}" >> "$GITHUB_OUTPUT"
Comment thread
lengau marked this conversation as resolved.
- name: Upload test coverage
uses: actions/upload-artifact@v7
with:
name: coverage-slow-${{ join(matrix.platform, '-') }}-${{ matrix.python-version }}
name: coverage-${{ steps.ctx.outputs.caller-job }}-slow-${{ join(matrix.platform, '-') }}-${{ matrix.python-version }}
overwrite: true
path: |
./coverage.xml
Expand All @@ -144,10 +164,20 @@ jobs:
MARKERS: ${{ inputs.pytest-markers }}
run: |
${{ inputs.test-command-prefix }} make test-coverage PYTEST_ADDOPTS="-m '${MARKERS}'"
- name: Resolve caller job name
id: ctx
if: ${{ !cancelled() }}
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
name=$(gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${{ job.check_run_id }}" --jq '.name')
caller="${name%% / *}"
echo "caller-job=${caller}" >> "$GITHUB_OUTPUT"
Comment thread
lengau marked this conversation as resolved.
- name: Upload test coverage
uses: actions/upload-artifact@v7
with:
name: coverage-lowest-py${{ inputs.lowest-python-version }}
name: coverage-${{ steps.ctx.outputs.caller-job }}-lowest-py${{ inputs.lowest-python-version }}
overwrite: true
path: |
./coverage.xml
Expand Down
Loading