Skip to content

Commit ebbe4c0

Browse files
author
Alex J Lennon
committed
Restructure CI: Test first, then build both architectures
- Separate test job runs first - Build jobs run in parallel after tests pass (needs: test) - Cleaner separation of concerns
1 parent 6fb940e commit ebbe4c0

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,34 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
test:
12+
name: Run Tests
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # Fetch full git history for commit hash
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: '8.0.x'
24+
25+
- name: Get Git Commit Hash
26+
id: git
27+
run: echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
28+
29+
- name: Test
30+
run: |
31+
# Just run tests - dotnet test will build both projects as needed
32+
# The test project depends on the main project, so both get built correctly
33+
dotnet test tests/InstDotNet.Tests.csproj -c Release -p:GitCommitHash=${{ steps.git.outputs.hash }} --verbosity normal
34+
continue-on-error: false
35+
1136
build:
1237
name: Build Native Binaries
38+
needs: test
1339
runs-on: ubuntu-latest
1440
strategy:
1541
matrix:
@@ -35,13 +61,6 @@ jobs:
3561
# Clean obj and bin directories to ensure each architecture build starts fresh
3662
# This prevents issues with shared obj directory between different runtime builds
3763
rm -rf obj bin publish
38-
39-
- name: Test
40-
run: |
41-
# Just run tests - dotnet test will build both projects as needed
42-
# The test project depends on the main project, so both get built correctly
43-
dotnet test tests/InstDotNet.Tests.csproj -c Release -p:GitCommitHash=${{ steps.git.outputs.hash }} --verbosity normal
44-
continue-on-error: false
4564
4665
- name: Publish Release for ${{ matrix.runtime }}
4766
run: dotnet publish src/InstDotNet.csproj -c Release -r ${{ matrix.runtime }} --self-contained false -o ./publish/${{ matrix.runtime }} -p:GitCommitHash=${{ steps.git.outputs.hash }}

0 commit comments

Comments
 (0)