-
-
Notifications
You must be signed in to change notification settings - Fork 567
113 lines (96 loc) · 2.9 KB
/
test-suite.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
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
# This workflow will install Python dependencies, download Docker images, and test every script in the repo
name: Glotter
on:
push:
branches: [ main ]
paths:
- 'archive/**'
- '.github/workflows/test-suite.yml'
- '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.any_changed }}
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get changed code files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
archive/**
.github/workflows/test-suite.yml
scripts/run_tests.py
files_ignore: |
**/*.md
- name: List all relevant changed files
if: steps.changed-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_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' }}
strategy:
fail-fast: true
matrix:
python-version: ["3.11"]
poetry-version: ["1.8.4"]
os: [ubuntu-latest]
num_batches: [6]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run Poetry Image
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ matrix.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 ${{ matrix.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