Skip to content

Commit caacdae

Browse files
first pass at refactoring the github testing
1 parent 045220a commit caacdae

File tree

3 files changed

+61
-23
lines changed

3 files changed

+61
-23
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: test_controller
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
check_for_changes:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
run_full_tests: ${{ steps.set-outputs.outputs.run_full_tests }}
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dorny/paths-filter@v3
15+
id: filter
16+
with:
17+
filters: |
18+
code:
19+
- 'Code/**'
20+
tests:
21+
- 'tests/**'
22+
- name: Set consolidated outputs
23+
id: set-outputs
24+
env:
25+
CODE: ${{ steps.filter.outputs.code || 'false' }}
26+
TESTS: ${{ steps.filter.outputs.tests || 'false' }}
27+
run: |
28+
if [ "${CODE}" = "true" ] || [ "${TESTS}" = "true" ]; then
29+
RUN_FULL_TESTS=true
30+
else
31+
RUN_FULL_TESTS=false
32+
fi
33+
echo "run_full_tests=${RUN_FULL_TESTS}" >> "$GITHUB_OUTPUT"
34+
35+
# Dummy job that always passes when no code/tests changed
36+
test:
37+
needs: check_for_changes
38+
if: ${{ needs.check_for_changes.outputs.run_full_tests == 'false' }}
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: No relevant changes
42+
run: echo "✅ Docs-only change, skipping tests."
43+
44+
# Call Ubuntu reusable workflow
45+
test-ubuntu:
46+
needs: check_for_changes
47+
if: ${{ needs.check_for_changes.outputs.run_full_tests == 'true' }}
48+
uses: ./.github/workflows/test_ubuntu.yml
49+
50+
# Call macOS reusable workflow
51+
test-macos:
52+
needs: check_for_changes
53+
if: ${{ needs.check_for_changes.outputs.run_full_tests == 'true' }}
54+
uses: ./.github/workflows/test_macos.yml

.github/workflows/test_macos.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
name: macos-latest
1+
name: test-ubuntu
2+
23
on:
3-
push:
4-
paths:
5-
- 'Code/**'
6-
- 'tests/**'
7-
- '.github/**'
8-
pull_request:
9-
paths:
10-
- 'Code/**'
11-
- 'tests/**'
12-
- '.github/**'
4+
workflow_call:
135
jobs:
146
test:
157
runs-on: macos-latest

.github/workflows/test_ubuntu.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
name: ubuntu-latest
2-
on:
3-
push:
4-
paths:
5-
- 'Code/**'
6-
- 'tests/**'
7-
- '.github/**'
8-
pull_request:
9-
paths:
10-
- 'Code/**'
11-
- 'tests/**'
12-
- '.github/**'
1+
name: test-ubuntu
2+
3+
on:
4+
workflow_call:
135
jobs:
146
test:
157
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)