-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathnode-flow-pull-request-checks.yaml
More file actions
172 lines (157 loc) · 6.22 KB
/
node-flow-pull-request-checks.yaml
File metadata and controls
172 lines (157 loc) · 6.22 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# SPDX-License-Identifier: Apache-2.0
name: "Node: PR Checks"
on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
defaults:
run:
shell: bash
permissions:
id-token: write
actions: read
issues: write
pull-requests: write
statuses: write
checks: write
contents: read
concurrency:
group: pr-checks-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
detect-change-type:
name: Detect Change Type
runs-on: hl-cn-default-lin-sm
outputs:
docs-only: ${{ steps.classify.outputs.docs-only }}
enable-tests: ${{ steps.classify.outputs.enable-tests }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: "0"
- name: Classify Changed Files
id: classify
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const script = require('.github/workflows/support/scripts/classify-changed-files.js');
await script({github, context, core})
mats-pr-checks:
name: MATS
needs:
- detect-change-type
uses: ./.github/workflows/zxc-mats-tests.yaml
with:
ref: ${{ github.event.pull_request.head.sha }}
enable-spotless-check: "true"
enable-dependency-check: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-unit-tests: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-integration-tests: ${{ needs.detect-change-type.outputs.enable-tests }}
# general hapi tests include misc, misc records, iss, smart contract, restart, nd reconnect, atomic batch
enable-hapi-tests: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-hapi-tests-crypto: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-hapi-tests-token: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-hapi-tests-time-consuming: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-hapi-tests-state-throttling: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-hapi-tests-simplefees: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-hapi-tests-atomic-batch: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-hapi-tests-smart-contract: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-otter-tests: ${{ needs.detect-change-type.outputs.enable-tests }}
enable-snyk-scan: ${{ needs.detect-change-type.outputs.enable-tests }}
java-version: "25"
java-distribution: "temurin"
custom-job-label: "Standard"
secrets:
access-token: ${{ secrets.GITHUB_TOKEN }}
codacy-project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }}
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }}
snyk-token: ${{ secrets.SNYK_TOKEN }}
ci-complete:
name: CI Complete
runs-on: hl-cn-default-lin-sm
needs:
- detect-change-type
- mats-pr-checks
if: ${{ !cancelled() && always() }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Evaluate Results
run: |
echo "Docs-only: ${{ needs.detect-change-type.outputs.docs-only }}"
echo "MATS result: ${{ needs.mats-pr-checks.result }}"
if [[ "${{ needs.mats-pr-checks.result }}" == "success" ]]; then
echo "All required checks passed."
exit 0
else
echo "MATS checks did not succeed (result: ${{ needs.mats-pr-checks.result }})."
exit 1
fi
report-flaky-tests:
name: Report Flaky Tests
needs:
- detect-change-type
- mats-pr-checks
if: ${{ !cancelled() && always() }}
uses: ./.github/workflows/800-call-report-flaky-test.yaml
with:
workflow-context: pr-checks
secrets:
access-token: ${{ secrets.GITHUB_TOKEN }}
report-summary:
name: Report PR Check Summary
runs-on: hl-cn-default-lin-sm
needs:
- detect-change-type
- mats-pr-checks
- report-flaky-tests
if: ${{ !cancelled() && always() }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: "0"
ref: ${{ github.event.pull_request.head.sha }}
- name: Report Summary
id: report-summary
env:
PRINT_FAILED_TESTS_SCRIPT: ".github/workflows/support/scripts/print-failed-tests.sh"
run: |
echo "::debug::Generating PR Check Summary"
# Append summary to GitHub Step Summary
{
echo "## PR Check Summary"
echo ""
if [[ "${{ needs.detect-change-type.outputs.docs-only }}" == "true" ]]; then
echo "> **Docs-only PR detected.** Unit, integration, HAPI, otter, determinism, dependency, and Snyk checks were skipped. Build and Spotless still ran."
echo ""
fi
echo "------------------------------------"
echo "### Results"
echo "- **MATS Tests:** ${{ needs.mats-pr-checks.result }}"
echo "------------------------------------"
if [[ "${{ needs.mats-pr-checks.result }}" == "failure" ]]; then
echo "### MATS Test Failures"
echo ""
echo "- **Failure Mode:** ${{ needs.mats-pr-checks.outputs.failure-mode }}"
echo "- **Failed Tests:**"
bash "${{ github.workspace }}/${{ env.PRINT_FAILED_TESTS_SCRIPT }}" "${{ needs.mats-pr-checks.outputs.failed-tests }}"
echo "------------------------------------"
fi
} >> "${GITHUB_STEP_SUMMARY}"