-
Notifications
You must be signed in to change notification settings - Fork 164
54 lines (54 loc) · 2.21 KB
/
test-lp.yml
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
name: Test Learning Path
on: pull_request
jobs:
Test-Pull-Request:
runs-on: arm-linux-runner
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
ref: ${{ steps.vars.outputs.branch-name }}
- name: Get all changed markdown files
id: changed-markdown-files
uses: tj-actions/changed-files@v44
with:
files: |
**.md
- name: Install dependencies
if: steps.changed-markdown-files.outputs.any_changed == 'true'
run: pip install -r tools/requirements.txt
- name: Run test suite for all changed .md files
id: run-suite
if: steps.changed-markdown-files.outputs.any_changed == 'true'
# Run the test suite
run: |
set -o pipefail; ./tools/test_lp.sh ${{ steps.changed-markdown-files.outputs.all_changed_files }} 2>&1 | tee test-lp-output.txt
- name: Parse test suite errors
id: test-suite-state
if: success()
# Catch any missed errors if running multiple tests
run: |
cat test-lp-output.txt | grep -q 'Tests failed in test suite' && echo "TEST_SUITE_ERRORS=true" >> "$GITHUB_ENV" \
|| echo "TEST_SUITE_ERRORS=false" >> "$GITHUB_ENV"
- name: Check for errors in test suite
if: env.TEST_SUITE_ERRORS == 'true' && success()
run: |
echo "Test failures detected in test suite, check the output in earlier steps"
exit 1
- name: Parse test maintenance off
id: maintenance-state
if: success()
# Check if maintenance is turned off
run: |
cat test-lp-output.txt | grep -q 'maintenance is turned off' && echo "MAINTENANCE=off" >> "$GITHUB_ENV" \
|| echo "MAINTENANCE=on" >> "$GITHUB_ENV"
- name: Check if maintenance is turned off
if: env.MAINTENANCE == 'off' && success()
run: echo "Maintenance is turned off for one or more files"
# Only upload artifact if maintenance is on
- name: Upload stats artifact
uses: actions/upload-artifact@v4
if: success() && env.MAINTENANCE == 'on'
with:
name: stats_current_test_info
path: data/stats_current_test_info.yml