-
Notifications
You must be signed in to change notification settings - Fork 5
136 lines (118 loc) · 4.57 KB
/
ci-scheduled-e2e.yaml
File metadata and controls
136 lines (118 loc) · 4.57 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
name: ci-run-scheduled-e2e
on:
schedule:
# Every Monday at 09:00 UTC to catch regressions.
- cron: '0 9 * * 1'
workflow_dispatch:
concurrency:
group: scheduled-e2e-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-tests:
name: scheduled-e2e-tests 🔚2️⃣🔚
permissions:
contents: read
issues: write
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Bun
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.0.2
with:
bun-version: '1.3.11'
- name: Install deps
run: bun install --frozen-lockfile
- name: Install Foundry (anvil)
uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0
with:
version: v1.5.1
- name: Run ZKsync OS (L1-L2)
uses: matter-labs/zksync-server-action@6632ab9a6bd841c7849e8d62a4984734e018d89f # v0.1.1
with:
version: v0.18.1
protocol_version: v30.2
- name: Compile test contracts
id: compile_contracts
working-directory: tests/contracts
run: |
set -o pipefail
forge build 2>&1 | tee "$RUNNER_TEMP/forge-build.log"
- name: Run ethers e2e
id: ethers_e2e
continue-on-error: true
run: |
set -o pipefail
bun run test:e2e:ethers 2>&1 | tee "$RUNNER_TEMP/ethers-e2e.log"
- name: Run viem e2e
id: viem_e2e
continue-on-error: true
run: |
set -o pipefail
bun run test:e2e:viem 2>&1 | tee "$RUNNER_TEMP/viem-e2e.log"
- name: Fail workflow if any e2e suite failed
if: ${{ always() && steps.compile_contracts.outcome == 'success' }}
run: |
if [ "${{ steps.ethers_e2e.outcome }}" != "success" ] || [ "${{ steps.viem_e2e.outcome }}" != "success" ]; then
echo "One or more e2e suites failed."
exit 1
fi
- name: Open or update failure issue
if: ${{ failure() && github.ref_name == 'main' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
ISSUE_TITLE: Scheduled e2e workflow failing on main
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
issue_file="$RUNNER_TEMP/scheduled-e2e-issue.md"
append_log_section() {
local title="$1"
local file="$2"
{
echo "### ${title}"
echo
echo '```text'
if [ -f "$file" ]; then
tail -n 80 "$file"
else
echo "No log file was captured for this step."
fi
echo '```'
echo
} >> "$issue_file"
}
{
echo "## Scheduled e2e workflow failure"
echo
echo "- Workflow: \`${{ github.workflow }}\`"
echo "- Branch: \`${{ github.ref_name }}\`"
echo "- Commit: \`${{ github.sha }}\`"
echo "- Trigger: \`${{ github.event_name }}\`"
echo "- Run: [${{ github.run_id }}](${RUN_URL})"
echo "- Attempt: \`${{ github.run_attempt }}\`"
echo "- Failed at: \`$(date -u +"%Y-%m-%d %H:%M:%S UTC")\`"
echo
echo "## Step results"
echo
echo "| Step | Outcome |"
echo "| --- | --- |"
echo "| Compile test contracts | ${{ steps.compile_contracts.outcome }} |"
echo "| Run ethers e2e | ${{ steps.ethers_e2e.outcome || 'skipped' }} |"
echo "| Run viem e2e | ${{ steps.viem_e2e.outcome || 'skipped' }} |"
echo
echo "<details>"
echo "<summary>Log excerpts</summary>"
echo
} > "$issue_file"
append_log_section "Compile test contracts" "$RUNNER_TEMP/forge-build.log"
append_log_section "Run ethers e2e" "$RUNNER_TEMP/ethers-e2e.log"
append_log_section "Run viem e2e" "$RUNNER_TEMP/viem-e2e.log"
echo "</details>" >> "$issue_file"
existing_issue_number="$(gh issue list --state open --search "\"${ISSUE_TITLE}\" in:title" --limit 1 --json number --jq '.[0].number // empty')"
if [ -n "$existing_issue_number" ]; then
gh issue comment "$existing_issue_number" --body-file "$issue_file"
else
gh issue create --title "$ISSUE_TITLE" --body-file "$issue_file"
fi