Merge branch 'master' into implement-on-demand-capability #307
This file contains hidden or 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
| name: E2E Testing - Personal Account | |
| on: | |
| push: | |
| branches-ignore: | |
| - master | |
| - main | |
| paths: | |
| - 'src/**' | |
| - 'ci/**' | |
| - '.github/workflows/e2e-personal.yaml' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| e2e_personal: | |
| if: github.repository == 'abraunegg/onedrive' | |
| runs-on: ubuntu-latest | |
| container: fedora:latest | |
| environment: | |
| name: e2e-personal | |
| deployment: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: | | |
| dnf -y update | |
| dnf -y group install development-tools | |
| dnf -y install python3 ldc libcurl-devel sqlite-devel dbus-devel jq fuse3-devel | |
| - name: Build + local install prefix | |
| run: | | |
| ./configure --prefix="$PWD/.ci/prefix" | |
| make -j"$(nproc)" | |
| make install | |
| "$PWD/.ci/prefix/bin/onedrive" --version | |
| - name: Prepare isolated HOME | |
| run: | | |
| set -euo pipefail | |
| export HOME="$RUNNER_TEMP/home-personal" | |
| echo "HOME=$HOME" >> "$GITHUB_ENV" | |
| echo "XDG_CONFIG_HOME=$HOME/.config" >> "$GITHUB_ENV" | |
| echo "XDG_CACHE_HOME=$HOME/.cache" >> "$GITHUB_ENV" | |
| mkdir -p "$HOME" | |
| - name: Inject refresh token into onedrive config | |
| env: | |
| REFRESH_TOKEN_PERSONAL: ${{ secrets.REFRESH_TOKEN_PERSONAL }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p "$XDG_CONFIG_HOME/onedrive" | |
| umask 077 | |
| printf "%s" "$REFRESH_TOKEN_PERSONAL" > "$XDG_CONFIG_HOME/onedrive/refresh_token" | |
| chmod 600 "$XDG_CONFIG_HOME/onedrive/refresh_token" | |
| - name: Run E2E harness | |
| continue-on-error: true | |
| env: | |
| ONEDRIVE_BIN: ${{ github.workspace }}/.ci/prefix/bin/onedrive | |
| E2E_TARGET: personal | |
| RUN_ID: ${{ github.run_id }} | |
| PYTHONUNBUFFERED: "1" | |
| run: | | |
| python3 -u ci/e2e/run.py | |
| - name: Debug rerun failed E2E cases | |
| continue-on-error: true | |
| if: always() | |
| env: | |
| ONEDRIVE_BIN: ${{ github.workspace }}/.ci/prefix/bin/onedrive | |
| E2E_TARGET: personal | |
| RUN_ID: ${{ github.run_id }} | |
| PYTHONUNBUFFERED: "1" | |
| run: | | |
| set -euo pipefail | |
| if [ -f ci/e2e/out/results.json ]; then | |
| python3 -u ci/e2e/rerun_failures.py \ | |
| --results ci/e2e/out/results.json \ | |
| --output-subdir debug-rerun \ | |
| --run-label debug-rerun \ | |
| --skip-suite-cleanup | |
| else | |
| echo "No primary results.json found; skipping debug rerun" | |
| fi | |
| - name: Evaluate E2E gate result | |
| if: always() | |
| run: | | |
| python3 -u ci/e2e/evaluate_rerun_gate.py \ | |
| --primary-results ci/e2e/out/results.json \ | |
| --debug-results ci/e2e/out/debug-rerun/results.json \ | |
| --gate-file ci/e2e/out/gate.json | |
| - name: Upload E2E artefacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: e2e-personal | |
| path: ci/e2e/out/** | |
| pr_comment: | |
| name: Post PR summary comment | |
| needs: [ e2e_personal ] | |
| runs-on: ubuntu-latest | |
| if: always() && github.repository == 'abraunegg/onedrive' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artefact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: e2e-personal | |
| path: artifacts/e2e-personal | |
| - name: Build markdown summary | |
| id: summary | |
| run: | | |
| set -euo pipefail | |
| primary_results="artifacts/e2e-personal/results.json" | |
| gate_results="artifacts/e2e-personal/gate.json" | |
| if [ -f "$primary_results" ]; then | |
| f="$primary_results" | |
| else | |
| f="$(find artifacts/e2e-personal \ | |
| -path '*/debug-rerun/*' -prune -o \ | |
| -name results.json -type f -print | head -n 1 || true)" | |
| fi | |
| if [ -z "$f" ] || [ ! -f "$f" ]; then | |
| echo "md=⚠️ E2E ran but results.json was not found." >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| target=$(jq -r '.target // "personal"' "$f") | |
| debug_recovered="false" | |
| if [ -f "$gate_results" ]; then | |
| debug_recovered="$(jq -r '.recovered_by_debug_rerun // false' "$gate_results")" | |
| effective_results="$(jq -r '.effective_results // empty' "$gate_results")" | |
| if [ "$debug_recovered" = "true" ] && [ -n "$effective_results" ]; then | |
| candidate="artifacts/e2e-personal/${effective_results#ci/e2e/out/}" | |
| if [ -f "$candidate" ]; then | |
| f="$candidate" | |
| fi | |
| fi | |
| fi | |
| total=$(jq -r '.cases | length' "$f") | |
| passed=$(jq -r '[.cases[] | select(.status=="pass")] | length' "$f") | |
| failed=$(jq -r '[.cases[] | select(.status=="fail")] | length' "$f") | |
| failures=$(jq -r '.cases[] | |
| | select(.status=="fail") | |
| | "- Test Case \(.id // "????"): \(.name) — \(.reason // "no reason provided")"' "$f" || true) | |
| md="## ${target^} Account Testing\n" | |
| md+="**${total}** Test Cases Run \n" | |
| md+="**${passed}** Test Cases Passed \n" | |
| md+="**${failed}** Test Cases Failed \n\n" | |
| if [ "$debug_recovered" = "true" ]; then | |
| md+="⚠️ Primary run had transient failure(s), but all failed case(s) passed during debug rerun. Treating workflow as passed. \n\n" | |
| fi | |
| if [ "$failed" -gt 0 ] && [ -n "$failures" ]; then | |
| md+="### ${target^} Account Test Failures\n" | |
| md+="$failures\n" | |
| fi | |
| echo "md<<EOF" >> "$GITHUB_OUTPUT" | |
| echo -e "$md" >> "$GITHUB_OUTPUT" | |
| echo "EOF" >> "$GITHUB_OUTPUT" | |
| - name: Find PR associated with this commit | |
| id: pr | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const sha = context.sha; | |
| const prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
| owner, repo, commit_sha: sha | |
| }); | |
| if (!prs.data.length) { | |
| core.setOutput("found", "false"); | |
| return; | |
| } | |
| core.setOutput("found", "true"); | |
| core.setOutput("number", String(prs.data[0].number)); | |
| - name: Post PR comment | |
| if: steps.pr.outputs.found == 'true' | |
| uses: actions/github-script@v7 | |
| env: | |
| COMMENT_MD: ${{ steps.summary.outputs.md }} | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const issue_number = Number("${{ steps.pr.outputs.number }}"); | |
| const md = process.env.COMMENT_MD || "⚠️ No summary text produced."; | |
| await github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number, | |
| body: md | |
| }); |