-
Notifications
You must be signed in to change notification settings - Fork 520
183 lines (175 loc) · 6.21 KB
/
ci.yml
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Garnet .NET CI
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
jobs:
changes:
name: Check for changes
runs-on: ubuntu-latest # don't need matrix to test where the changes were made in code
permissions:
pull-requests: read
contents: read
outputs:
tsavorite: ${{ steps.filter.outputs.tsavorite }}
website: ${{ steps.filter.outputs.website }}
garnet: ${{ steps.filter.outputs.garnet }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Apply filter
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
tsavorite:
- 'libs/storage/Tsavorite/**'
website:
- 'website/**'
garnet:
- '!((*.md)|(website/**))'
format-garnet:
name: Format Garnet
needs: changes
runs-on: ubuntu-latest
if: needs.changes.outputs.garnet == 'true'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore Garnet.sln
- name: Check style format
run: dotnet format Garnet.sln --no-restore --verify-no-changes --verbosity diagnostic
format-tsavorite:
name: Format Tsavorite
needs: changes
runs-on: ubuntu-latest
if: needs.changes.outputs.tsavorite == 'true'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore libs/storage/Tsavorite/cs/Tsavorite.sln
- name: Check style format
run: dotnet format libs/storage/Tsavorite/cs/Tsavorite.sln --no-restore --verify-no-changes --verbosity diagnostic
# Job to build and test Garnet code
build-test-garnet:
name: Garnet
needs: [changes, format-garnet]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
framework: [ 'net8.0' ]
configuration: [ 'Debug', 'Release' ]
test: [ 'Garnet.test', 'Garnet.test.cluster' ]
if: needs.changes.outputs.garnet == 'true'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build Garnet
run: dotnet build --configuration ${{ matrix.configuration }}
- name: Run tests ${{ matrix.test }}
run: dotnet test test/${{ matrix.test }} -f ${{ matrix.framework }} --configuration ${{ matrix.configuration }} --logger "console;verbosity=detailed" --logger trx --results-directory "GarnetTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }}"
timeout-minutes: 45
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: dotnet-garnet-results-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }}
path: GarnetTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}-${{ matrix.test }}
if: ${{ always() }}
# Job to build and test Tsavorite code (only if there were changes to it)
build-test-tsavorite:
name: Tsavorite
needs: [changes, format-tsavorite]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
framework: [ 'net8.0' ]
configuration: [ 'Debug', 'Release' ]
if: needs.changes.outputs.tsavorite == 'true'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set environment variable for Linux
run: echo "RunAzureTests=yes" >> $GITHUB_ENV
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Set environment variable for Windows
run: echo ("RunAzureTests=yes") >> $env:GITHUB_ENV
if: ${{ matrix.os == 'windows-latest' }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup Node.js for Azurite
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install and Run Azurite
shell: bash
run: |
npm install -g azurite
azurite &
- name: Install dependencies
run: dotnet restore
- name: Build Tsavorite
run: dotnet build libs/storage/Tsavorite/cs/test/Tsavorite.test.csproj --configuration ${{ matrix.configuration }}
- name: Run Tsavorite tests
run: dotnet test libs/storage/Tsavorite/cs/test/Tsavorite.test.csproj -f ${{ matrix.framework }} --configuration ${{ matrix.configuration }} --logger "console;verbosity=detailed" --logger trx --results-directory "TsavoriteTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}"
timeout-minutes: 45
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: dotnet-tsavorite-results-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}
path: TsavoriteTestResults-${{ matrix.os }}-${{ matrix.framework }}-${{ matrix.configuration }}
if: ${{ always() }}
build-website:
name: Build Website
needs: changes
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
if: needs.changes.outputs.website == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
cache-dependency-path: ./website/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build
pipeline-success:
name: Garnet CI (Complete)
runs-on: ubuntu-latest
needs: [ build-test-garnet, build-test-tsavorite, build-website ]
steps:
- run: echo Done!
if: ${{ !(failure() || cancelled()) }}