Skip to content

Commit 5926d1c

Browse files
committed
Add nightly.yaml to simulate full validation with the possibility to set the result using an env variable
1 parent c0a1d25 commit 5926d1c

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

.github/workflows/nightly.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Nightly Build
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
7+
jobs:
8+
full-validation:
9+
runs-on: ubuntu-latest
10+
environment: DEV
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Run tests (controlled via environment variable)
16+
run: |
17+
echo "Running nightly tests..."
18+
echo "TEST_RESULT_OVERRIDE: ${{ vars.TEST_RESULT_OVERRIDE }}"
19+
20+
if [ -n "${{ vars.TEST_RESULT_OVERRIDE }}" ]; then
21+
if [ "${{ vars.TEST_RESULT_OVERRIDE }}" == "pass" ]; then
22+
echo "Tests passed by override (via environment)!"
23+
exit 0
24+
elif [ "${{ vars.TEST_RESULT_OVERRIDE }}" == "fail" ]; then
25+
echo "Tests failed by override (via environment)!"
26+
exit 1
27+
fi
28+
else
29+
echo "Random test result mode..."
30+
if [ $((RANDOM % 2)) -eq 0 ]; then
31+
echo "Tests passed!"
32+
exit 0
33+
else
34+
echo "Tests failed!"
35+
exit 1
36+
fi
37+
fi
38+
39+
- name: Mark workflow as successful
40+
if: success()
41+
run: echo "Tests passed successfully!"

.github/workflows/labels.yaml renamed to .github/workflows/validate.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
uses: actions/github-script@v7
5050
with:
5151
script: |
52+
5253
const labels = context.payload.pull_request.labels.map(label => label.name);
5354
const hasQuickValidation = labels.includes('quick validation');
5455
const hasFullValidation = labels.includes('full validation');

0 commit comments

Comments
 (0)