-
-
Notifications
You must be signed in to change notification settings - Fork 914
156 lines (129 loc) · 4.74 KB
/
Copy pathe2e-personal.yaml
File metadata and controls
156 lines (129 loc) · 4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: E2E Personal Account Testing
on:
push:
branches-ignore:
- master
- main
permissions:
contents: read
pull-requests: write
issues: write
jobs:
e2e_personal:
runs-on: ubuntu-latest
container: fedora:latest
environment: onedrive-e2e
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
- 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
env:
ONEDRIVE_BIN: ${{ github.workspace }}/.ci/prefix/bin/onedrive
E2E_TARGET: personal
RUN_ID: ${{ github.run_id }}
run: |
python3 ci/e2e/run.py
- 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()
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
f="$(find artifacts/e2e-personal -name results.json -type f | head -n 1 || true)"
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")
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 [ "$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
});