Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/provision-and-run-e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ jobs:
name: Provision VM
runs-on: ubuntu-latest
permissions:
# Needed by actions/checkout
contents: read
actions: write
# Needed to push OCI artifact to ghcr.io
packages: write
steps:
- name: Checkout repo
Expand Down
55 changes: 52 additions & 3 deletions .github/workflows/run-e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ jobs:
name: Run e2e-tests (${{ inputs.broker }})
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
# Needed by JamesIves/github-pages-deploy-action
contents: write
# Needed to pull OCI artifacts from ghcr.io
packages: read
# Needed to use the commit statuses API to show a PR check for the e2e-test logs
statuses: write
steps:
- uses: oras-project/setup-oras@v1
- name: Download VM image OCI artifact
Expand Down Expand Up @@ -155,10 +158,56 @@ jobs:
--broker "${{ inputs.broker }}" \
--output-dir "${{ env.OUTPUT_DIR }}"

- name: Upload test results
# Redact secrets from the test output
for file in "${{ env.OUTPUT_DIR }}"/{log,report}.html; do
sed -i "s/${E2E_PASSWORD}/<redacted-password>/g" "$file"
sed -i "s/${TOTP_SECRET}/<redacted-totp-secret>/g" "$file"
done

- name: Upload test results as artifact
id: upload-results
if: always()
uses: actions/upload-artifact@v6
with:
name: e2e-${{ inputs.broker }}-output-${{ inputs.release }}-${{ github.run_id }}
path: ${{ env.OUTPUT_DIR }}

- name: Prepare upload to Pages
id: prepare-pages
if: always()
run: |
set -euo pipefail
TARGET_DIR="pr/${{ github.event.pull_request.number }}/${{ github.run_id }}/${{ github.run_attempt }}/e2e-tests/${{ inputs.release }}/${{ inputs.broker }}"
mkdir -p "pages/${TARGET_DIR}"
cp "${{ env.OUTPUT_DIR }}"/*.html "pages/${TARGET_DIR}/"
echo "target-dir=${TARGET_DIR}" >> "$GITHUB_OUTPUT"

OWNER="${{ github.repository_owner }}"
REPO="$(basename "${{ github.repository }}")"
echo "log-url=https://$OWNER.github.io/$REPO/$TARGET_DIR/log.html" >> "$GITHUB_OUTPUT"

- name: Deploy to GitHub Pages
id: deploy-pages
if: always() && steps.prepare-pages.outcome == 'success'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: pages/
# Don't delete the existing pages, so we don't overwrite other PRs' test results
clean: false
# Rebase instead of force-push, so concurrent PRs don't overwrite each other
force: false

- name: Post link to logs as a PR check
uses: actions/github-script@v7
if: always() && steps.deploy-pages.outcome == 'success'
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: '${{ steps.run-tests.outcome }}',
target_url: '${{ steps.prepare-pages.outputs.log-url }}',
description: 'View logs',
context: 'e2e-tests (${{ inputs.release }}) (${{ inputs.broker }})',
});
Loading