forked from TheRenegadeCoder/sample-programs
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (111 loc) · 3.34 KB
/
test-suite.yml
File metadata and controls
130 lines (111 loc) · 3.34 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
# This workflow will install Python dependencies, download Docker images, and test every script in the repo
name: Glotter
permissions:
contents: read
on:
push:
branches: [ main ]
paths:
- 'archive/**'
- '.glotter.yml'
- 'repo-config.yml'
- '.github/workflows/test-suite.yml'
- 'pyproject.toml'
- 'poetry.lock'
- 'scripts/run_tests.py'
- '!**/*.md'
pull_request:
branches:
- 'main'
schedule:
# Run every Wednesday at 10:39 UTC (randomly chosen)
- cron: '39 10 * * 3'
jobs:
# We need this job to check if changed files should trigger testing
changed-files:
name: "Changed Files"
runs-on: ubuntu-latest
outputs:
status: ${{ steps.changed-files.outputs.exists }}
changed_files: ${{ steps.changed-files.outputs.files }}
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
verbose: true
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-large-packages: true
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Get changed code files
id: changed-files
uses: yumemi-inc/changed-files@v3
with:
patterns: |
archive/**
.glotter.yml
repo-config.yml
.github/workflows/test-suite.yml
pyproject.toml
poetry.lock
scripts/run_tests.py
!**/*.md
- name: List all relevant changed files
if: steps.changed-files.outputs.exists == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
# We need this job to test all code in the codebase
testing:
name: "Test Suite"
needs: changed-files
if: needs.changed-files.outputs.status == 'true' || ${{ github.event_name == 'schedule' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Read repo config
uses: pietrobolcato/action-read-yaml@1.1.0
id: repo-config
with:
config: repo-config.yml
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ steps.repo-config.outputs['python-version'] }}"
- name: Run Poetry Image
uses: abatilo/actions-poetry@v3
with:
poetry-version: "${{ steps.repo-config.outputs['poetry-version'] }}"
- name: Install Dependencies
run: poetry install
- name: Check for Bad Files
run: poetry run glotter check
- name: Download Docker images, Test Appropriate Sample Programs, Remove Docker Images
run: poetry run python scripts/run_tests.py
--event ${{ github.event_name }}
--num-batches ${{ steps.repo-config.outputs['num-batches'] }}
--parallel
--remove
${{ needs.changed-files.outputs.changed_files }}
# Because testing uses a matrix, we need this job for branch protections
test-results:
name: Test Results
needs: testing
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- run: |
result="${{ needs.testing.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi