Repository navigation
142 lines (135 loc) · 5.44 KB
/
Copy pathci.yml
File metadata and controls
142 lines (135 loc) · 5.44 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
DOTNET_NOLOGO: 'true'
jobs:
fast-tests:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
- run: dotnet restore StorageFlow.sln
- name: Release build
run: dotnet build StorageFlow.sln -c Release --no-restore --warnaserror
- name: Unit tests
run: >-
dotnet test tests/StorageFlow.Tests.Unit/StorageFlow.Tests.Unit.csproj
-c Release --no-build --logger "trx;LogFileName=unit.trx"
--collect "XPlat Code Coverage"
- name: Component tests
run: >-
dotnet test tests/StorageFlow.Tests.Component/StorageFlow.Tests.Component.csproj
-c Release --no-build --logger "trx;LogFileName=component.trx"
--collect "XPlat Code Coverage"
- name: Verify fast tests have no skips
shell: bash
run: |
if find tests/StorageFlow.Tests.Unit tests/StorageFlow.Tests.Component \
-path '*/TestResults/*.trx' -exec grep -H 'outcome="NotExecuted"' {} + | grep -q .; then
echo "Unit and component suites must complete with zero skipped tests."
exit 1
fi
- name: Pack public packages
shell: bash
run: |
projects=(
src/StorageFlow.Abstractions/StorageFlow.Abstractions.csproj
src/StorageFlow.Core/StorageFlow.Core.csproj
src/StorageFlow.Provider.S3/StorageFlow.Provider.S3.csproj
src/StorageFlow.Provider.Minio/StorageFlow.Provider.Minio.csproj
src/StorageFlow.Provider.RustFs/StorageFlow.Provider.RustFs.csproj
src/StorageFlow.Extension.Redis/StorageFlow.Extension.Redis.csproj
)
for project in "${projects[@]}"; do
dotnet pack "$project" -c Release --no-build --no-restore -o artifacts/packages
done
- name: Verify package boundaries
shell: bash
run: |
package_count=$(find artifacts/packages -maxdepth 1 -name '*.nupkg' | wc -l | tr -d ' ')
symbol_count=$(find artifacts/packages -maxdepth 1 -name '*.snupkg' | wc -l | tr -d ' ')
if [ "$package_count" -ne 6 ] || [ "$symbol_count" -ne 6 ]; then
echo "Expected 6 public packages and 6 symbol packages; found $package_count and $symbol_count."
exit 1
fi
core_package=$(find artifacts/packages -name 'StorageFlow.Core.*.nupkg' -print -quit)
unzip -l "$core_package" | grep -q 'StorageFlow.Core.dll'
for package in artifacts/packages/*.nupkg; do
assembly_name=$(basename "$package" | sed -E 's/\.[0-9]+\..*$//')
unzip -l "$package" | grep -q "lib/net9.0/$assembly_name.dll"
unzip -l "$package" | grep -q "lib/net9.0/$assembly_name.xml"
readme_heading=$(unzip -p "$package" README.md | sed -n '1p' | tr -d '\r')
if [ "$readme_heading" != "# $assembly_name" ]; then
echo "Package README heading does not match $assembly_name."
exit 1
fi
if unzip -p "$package" 'lib/net9.0/*.dll' | strings | grep -E 'InMemoryStorageProvider|UseInMemory'; then
echo "InMemory APIs leaked into $package."
exit 1
fi
if unzip -p "$package" '*.nuspec' | grep -q 'dependency id="StorageFlow.Testing"'; then
echo "StorageFlow.Testing dependency leaked into $package."
exit 1
fi
done
- name: Upload NuGet packages
uses: actions/upload-artifact@v7
with:
name: nuget-packages
path: |
artifacts/packages/*.nupkg
artifacts/packages/*.snupkg
if-no-files-found: error
- name: Upload fast test results
if: always()
uses: actions/upload-artifact@v7
with:
name: fast-test-results
path: '**/TestResults/**'
docker-integration:
runs-on: ubuntu-latest
needs: fast-tests
timeout-minutes: 45
env:
STORAGEFLOW_TEST_DOCKER: 'true'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
- name: Verify Docker availability
run: docker info
- run: dotnet restore tests/StorageFlow.Tests.Integration/StorageFlow.Tests.Integration.csproj
- name: Docker integration tests
run: >-
dotnet test tests/StorageFlow.Tests.Integration/StorageFlow.Tests.Integration.csproj
-c Release --no-restore -p:TreatWarningsAsErrors=true
--logger "trx;LogFileName=integration.trx"
--collect "XPlat Code Coverage"
- name: Verify Docker tests have no skips
shell: bash
run: |
if find tests/StorageFlow.Tests.Integration \
-path '*/TestResults/*.trx' -exec grep -H 'outcome="NotExecuted"' {} + | grep -q .; then
echo "Docker integration tests were enabled but one or more tests were skipped."
exit 1
fi
- name: Upload integration test results
if: always()
uses: actions/upload-artifact@v7
with:
name: docker-integration-results
path: '**/TestResults/**'