Skip to content

Commit 2bb05aa

Browse files
authored
Refactor workflows to reuse CI for prerelease gating (#2704)
1 parent 2f9c286 commit 2bb05aa

File tree

3 files changed

+143
-264
lines changed

3 files changed

+143
-264
lines changed

.github/workflows/_reusable-ci.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Reusable CI (Build & Test)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
sdk-matrix:
7+
required: false
8+
type: string
9+
default: |
10+
[
11+
{ "display": ".NET 8", "sdk": "8.0.x", "framework": "net8.0", "includePrerelease": false },
12+
{ "display": ".NET 9", "sdk": "9.0.x\n8.0.x", "framework": "net8.0", "includePrerelease": true },
13+
{ "display": ".NET 10", "sdk": "10.0.x\n8.0.x", "framework": "net8.0", "includePrerelease": true }
14+
]
15+
16+
jobs:
17+
build-linux:
18+
name: Build (Linux)
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Check out repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up .NET SDK
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: 8.0.x
31+
32+
- name: Restore
33+
run: dotnet restore LiteDB.sln
34+
35+
- name: Build
36+
run: dotnet build LiteDB.sln --configuration Release --no-restore /p:DefineConstants=TESTING
37+
38+
- name: Package build outputs
39+
run: tar -czf tests-build-linux.tar.gz LiteDB/bin/Release LiteDB/obj/Release LiteDB.Tests/bin/Release LiteDB.Tests/obj/Release
40+
41+
- name: Upload linux test build
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: tests-build-linux
45+
path: tests-build-linux.tar.gz
46+
47+
test-linux:
48+
name: Test (Linux ${{ matrix.item.display }})
49+
runs-on: ubuntu-latest
50+
needs: build-linux
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
item: ${{ fromJson(inputs.sdk-matrix) }}
55+
56+
steps:
57+
- name: Check out repository
58+
uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Set up .NET SDK ${{ matrix.item.display }}
63+
uses: actions/setup-dotnet@v4
64+
with:
65+
dotnet-version: ${{ matrix.item.sdk }}
66+
include-prerelease: ${{ matrix.item.includePrerelease }}
67+
68+
- name: Download build artifacts
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: tests-build-linux
72+
73+
- name: Extract build artifacts
74+
run: tar -xzf tests-build-linux.tar.gz
75+
76+
- name: Build test project for target framework
77+
run: >-
78+
dotnet build LiteDB.Tests/LiteDB.Tests.csproj
79+
--configuration Release
80+
--framework ${{ matrix.item.framework }}
81+
--no-dependencies
82+
83+
- name: Run tests
84+
timeout-minutes: 5
85+
run: >-
86+
dotnet test LiteDB.Tests/LiteDB.Tests.csproj
87+
--configuration Release
88+
--no-build
89+
--framework ${{ matrix.item.framework }}
90+
--verbosity normal
91+
--settings tests.runsettings
92+
--logger "trx;LogFileName=TestResults.trx"
93+
--logger "console;verbosity=detailed"
94+
95+
repro-runner:
96+
runs-on: ubuntu-latest
97+
needs: build-linux
98+
99+
steps:
100+
- name: Check out repository
101+
uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 0
104+
105+
- name: Set up .NET SDK
106+
uses: actions/setup-dotnet@v4
107+
with:
108+
dotnet-version: 8.0.x
109+
110+
- name: Restore
111+
run: dotnet restore LiteDB.sln
112+
113+
- name: Build
114+
run: dotnet build LiteDB.sln --configuration Release --no-restore
115+
116+
- name: List repros
117+
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- list --strict
118+
119+
- name: Validate manifests
120+
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- validate
121+
122+
- name: Run repro suite
123+
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- run --all --report repro-summary.json
124+
125+
- name: Upload repro summary
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: repro-summary
129+
path: repro-summary.json

.github/workflows/ci.yml

Lines changed: 2 additions & 237 deletions
Original file line numberDiff line numberDiff line change
@@ -4,240 +4,5 @@ on:
44
pull_request:
55

66
jobs:
7-
build-linux:
8-
name: Build (Linux)
9-
runs-on: ubuntu-latest
10-
11-
steps:
12-
- name: Check out repository
13-
uses: actions/checkout@v4
14-
with:
15-
fetch-depth: 0
16-
17-
- name: Set up .NET SDK
18-
uses: actions/setup-dotnet@v4
19-
with:
20-
dotnet-version: 8.0.x
21-
22-
- name: Restore
23-
run: dotnet restore LiteDB.sln
24-
25-
- name: Build
26-
run: dotnet build LiteDB.sln --configuration Release --no-restore /p:DefineConstants=TESTING
27-
28-
- name: Package build outputs
29-
run: tar -czf tests-build-linux.tar.gz LiteDB/bin/Release LiteDB/obj/Release LiteDB.Tests/bin/Release LiteDB.Tests/obj/Release
30-
31-
- name: Upload linux test build
32-
uses: actions/upload-artifact@v4
33-
with:
34-
name: tests-build-linux
35-
path: tests-build-linux.tar.gz
36-
37-
# build-windows:
38-
# name: Build (Windows)
39-
# runs-on: windows-latest
40-
41-
# steps:
42-
# - name: Check out repository
43-
# uses: actions/checkout@v4
44-
# with:
45-
# fetch-depth: 0
46-
47-
# - name: Set up .NET SDK
48-
# uses: actions/setup-dotnet@v4
49-
# with:
50-
# dotnet-version: 8.0.x
51-
52-
# - name: Restore
53-
# run: dotnet restore LiteDB.sln
54-
55-
# - name: Build
56-
# run: dotnet build LiteDB.sln --configuration Release --no-restore /p:DefineConstants=TESTING
57-
58-
# - name: Package build outputs
59-
# shell: pwsh
60-
# run: Compress-Archive -Path "LiteDB\bin\Release","LiteDB\obj\Release","LiteDB.Tests\bin\Release","LiteDB.Tests\obj\Release" -DestinationPath tests-build-windows.zip
61-
62-
# - name: Upload windows test build
63-
# uses: actions/upload-artifact@v4
64-
# with:
65-
# name: tests-build-windows
66-
# path: tests-build-windows.zip
67-
68-
test-linux:
69-
name: Test (Linux ${{ matrix.display }})
70-
runs-on: ubuntu-latest
71-
needs: build-linux
72-
strategy:
73-
fail-fast: false
74-
matrix:
75-
include:
76-
- display: .NET 8
77-
sdk: |
78-
8.0.x
79-
framework: net8.0
80-
include-prerelease: false
81-
- display: .NET 9
82-
sdk: |
83-
9.0.x
84-
8.0.x
85-
framework: net8.0
86-
include-prerelease: true
87-
- display: .NET 10
88-
sdk: |
89-
10.0.x
90-
8.0.x
91-
framework: net8.0
92-
include-prerelease: true
93-
94-
steps:
95-
- name: Check out repository
96-
uses: actions/checkout@v4
97-
with:
98-
fetch-depth: 0
99-
100-
- name: Set up .NET SDK ${{ matrix.display }}
101-
uses: actions/setup-dotnet@v4
102-
with:
103-
dotnet-version: ${{ matrix.sdk }}
104-
include-prerelease: ${{ matrix.include-prerelease }}
105-
106-
- name: Download build artifacts
107-
uses: actions/download-artifact@v4
108-
with:
109-
name: tests-build-linux
110-
111-
- name: Extract build artifacts
112-
run: tar -xzf tests-build-linux.tar.gz
113-
114-
- name: Build test project for target framework
115-
run: >-
116-
dotnet build LiteDB.Tests/LiteDB.Tests.csproj
117-
--configuration Release
118-
--framework ${{ matrix.framework }}
119-
--no-dependencies
120-
121-
- name: Run tests
122-
timeout-minutes: 5
123-
run: >-
124-
dotnet test LiteDB.Tests/LiteDB.Tests.csproj
125-
--configuration Release
126-
--no-build
127-
--framework ${{ matrix.framework }}
128-
--verbosity normal
129-
--settings tests.runsettings
130-
--logger "trx;LogFileName=TestResults.trx"
131-
--logger "console;verbosity=detailed"
132-
133-
# test-windows:
134-
# name: Test (Windows ${{ matrix.display }})
135-
# runs-on: windows-latest
136-
# needs: build-windows
137-
# strategy:
138-
# fail-fast: false
139-
# matrix:
140-
# include:
141-
# - display: .NET Framework 4.6.1
142-
# sdk: |
143-
# 8.0.x
144-
# framework: net461
145-
# include-prerelease: false
146-
# - display: .NET Framework 4.8.1
147-
# sdk: |
148-
# 8.0.x
149-
# framework: net481
150-
# include-prerelease: false
151-
# - display: .NET 8
152-
# sdk: |
153-
# 8.0.x
154-
# framework: net8.0
155-
# include-prerelease: false
156-
# - display: .NET 9
157-
# sdk: |
158-
# 9.0.x
159-
# 8.0.x
160-
# framework: net8.0
161-
# include-prerelease: true
162-
# - display: .NET 10
163-
# sdk: |
164-
# 10.0.x
165-
# 8.0.x
166-
# framework: net8.0
167-
# include-prerelease: true
168-
169-
# steps:
170-
# - name: Check out repository
171-
# uses: actions/checkout@v4
172-
# with:
173-
# fetch-depth: 0
174-
175-
# - name: Set up .NET SDK ${{ matrix.display }}
176-
# uses: actions/setup-dotnet@v4
177-
# with:
178-
# dotnet-version: ${{ matrix.sdk }}
179-
# include-prerelease: ${{ matrix.include-prerelease }}
180-
181-
# - name: Download build artifacts
182-
# uses: actions/download-artifact@v4
183-
# with:
184-
# name: tests-build-windows
185-
186-
# - name: Extract build artifacts
187-
# shell: pwsh
188-
# run: Expand-Archive -Path tests-build-windows.zip -DestinationPath . -Force
189-
190-
# - name: Build test project for target framework
191-
# run: >-
192-
# dotnet build LiteDB.Tests/LiteDB.Tests.csproj
193-
# --configuration Release
194-
# --framework ${{ matrix.framework }}
195-
# --no-dependencies
196-
197-
# - name: Run tests
198-
# timeout-minutes: 10
199-
# run: >-
200-
# dotnet test LiteDB.Tests/LiteDB.Tests.csproj
201-
# --configuration Release
202-
# --no-build
203-
# --framework ${{ matrix.framework }}
204-
# --verbosity normal
205-
# --settings tests.runsettings
206-
# --logger "trx;LogFileName=TestResults.trx"
207-
# --logger "console;verbosity=detailed"
208-
209-
repro-runner:
210-
runs-on: ubuntu-latest
211-
needs: build-linux
212-
213-
steps:
214-
- name: Check out repository
215-
uses: actions/checkout@v4
216-
with:
217-
fetch-depth: 0
218-
219-
- name: Set up .NET SDK
220-
uses: actions/setup-dotnet@v4
221-
with:
222-
dotnet-version: 8.0.x
223-
224-
- name: Restore
225-
run: dotnet restore LiteDB.sln
226-
227-
- name: Build
228-
run: dotnet build LiteDB.sln --configuration Release --no-restore
229-
230-
- name: List repros
231-
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- list --strict
232-
233-
- name: Validate manifests
234-
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- validate
235-
236-
- name: Run repro suite
237-
run: dotnet run --project LiteDB.ReproRunner/LiteDB.ReproRunner.Cli -- run --all --report repro-summary.json
238-
239-
- name: Upload repro summary
240-
uses: actions/upload-artifact@v4
241-
with:
242-
name: repro-summary
243-
path: repro-summary.json
7+
build-and-test:
8+
uses: ./.github/workflows/_reusable-ci.yml

0 commit comments

Comments
 (0)