1616 rust_projects : ${{ steps.filter.outputs.rust_projects }}
1717 go_projects : ${{ steps.filter.outputs.go_projects }}
1818 csharp_projects : ${{ steps.filter.outputs.csharp_projects }}
19+ zig_projects : ${{ steps.filter.outputs.zig_projects }}
1920 steps :
2021 - uses : actions/checkout@v4
2122 with :
@@ -37,13 +38,15 @@ jobs:
3738 ALL_RUST_PROJECTS=("2015" "2018" "2019/aoc_rust" "2020/01" "2021/_1" "2021/_2" "2021/_3" "2021/_4" "2021/_5" "2021/_6" "2021/_7" "2022")
3839 ALL_GO_PROJECTS=("2017" "2019/go" "2020/02" "2024/golang")
3940 ALL_CSHARP_PROJECTS=("2021/cs/1" "2021/cs/2")
41+ ALL_ZIG_PROJECTS=("2024/zig")
4042
4143 # Check for workflow changes - if workflow changed, run all tests
4244 if echo "$CHANGED_FILES" | grep -q "^.github/workflows/tests.yml"; then
4345 echo "Workflow changed, running all tests"
4446 RUST_PROJECTS=$(printf '%s\n' "${ALL_RUST_PROJECTS[@]}" | jq -R . | jq -s -c .)
4547 GO_PROJECTS=$(printf '%s\n' "${ALL_GO_PROJECTS[@]}" | jq -R . | jq -s -c .)
4648 CSHARP_PROJECTS=$(printf '%s\n' "${ALL_CSHARP_PROJECTS[@]}" | jq -R . | jq -s -c .)
49+ ZIG_PROJECTS=$(printf '%s\n' "${ALL_ZIG_PROJECTS[@]}" | jq -R . | jq -s -c .)
4750 else
4851 # Detect Rust projects
4952 RUST_PROJECTS=()
6972 fi
7073 done
7174
75+ # Detect Zig projects
76+ ZIG_PROJECTS=()
77+ for project in "${ALL_ZIG_PROJECTS[@]}"; do
78+ if echo "$CHANGED_FILES" | grep -q "^${project}/"; then
79+ ZIG_PROJECTS+=("$project")
80+ fi
81+ done
82+
7283 if [ ${#RUST_PROJECTS[@]} -eq 0 ]; then
7384 RUST_PROJECTS="[]"
7485 else
@@ -86,15 +97,23 @@ jobs:
8697 else
8798 CSHARP_PROJECTS=$(printf '%s\n' "${CSHARP_PROJECTS[@]}" | jq -R . | jq -s -c .)
8899 fi
100+
101+ if [ ${#ZIG_PROJECTS[@]} -eq 0 ]; then
102+ ZIG_PROJECTS="[]"
103+ else
104+ ZIG_PROJECTS=$(printf '%s\n' "${ZIG_PROJECTS[@]}" | jq -R . | jq -s -c .)
105+ fi
89106 fi
90107
91108 echo "rust_projects=$RUST_PROJECTS" >> $GITHUB_OUTPUT
92109 echo "go_projects=$GO_PROJECTS" >> $GITHUB_OUTPUT
93110 echo "csharp_projects=$CSHARP_PROJECTS" >> $GITHUB_OUTPUT
111+ echo "zig_projects=$ZIG_PROJECTS" >> $GITHUB_OUTPUT
94112
95113 echo "Rust projects to test: $RUST_PROJECTS"
96114 echo "Go projects to test: $GO_PROJECTS"
97115 echo "C# projects to test: $CSHARP_PROJECTS"
116+ echo "Zig projects to test: $ZIG_PROJECTS"
98117
99118 rust_tests :
100119 needs : detect_changes
@@ -181,3 +200,22 @@ jobs:
181200 - name : Run C# tests in ${{ matrix.project }}
182201 run : dotnet test
183202 working-directory : ${{ matrix.project }}
203+
204+ zig_tests :
205+ needs : detect_changes
206+ if : needs.detect_changes.outputs.zig_projects != '[]'
207+ runs-on : ubuntu-latest
208+ continue-on-error : true
209+ strategy :
210+ fail-fast : false
211+ matrix :
212+ project : ${{ fromJson(needs.detect_changes.outputs.zig_projects) }}
213+ steps :
214+ - uses : actions/checkout@v4
215+ - name : Set up Zig
216+ uses : goto-bus-stop/setup-zig@v2
217+ with :
218+ version : master
219+ - name : Run Zig tests in ${{ matrix.project }}
220+ run : zig build test
221+ working-directory : ${{ matrix.project }}
0 commit comments