-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (164 loc) · 5.16 KB
/
ci.yml
File metadata and controls
171 lines (164 loc) · 5.16 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
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
name: CI Build
on:
push:
branches:
- "main"
paths:
- "src/**"
- "**/*.props"
- "*.slnx"
- "global.json"
- ".github/workflows/ci.yml"
pull_request:
paths:
- "src/**"
- "**/*.props"
- "*.slnx"
- "global.json"
- ".github/workflows/ci.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
dotnet: ${{ steps.filter.outputs.dotnet }}
go: ${{ steps.filter.outputs.go }}
python: ${{ steps.filter.outputs.python }}
web: ${{ steps.filter.outputs.web }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: dorny/paths-filter@9d7afb8d214ad99e78fbd4247752c4caed2b6e4c # v4.0.0
id: filter
with:
filters: |
dotnet:
- 'src/Garage.ApiService/**'
- 'src/Garage.ApiDatabaseSeeder/**'
- 'src/Garage.ApiModel/**'
- 'src/Garage.AppHost/**'
- 'src/Garage.ServiceDefaults/**'
- 'src/Garage.Shared/**'
- '**/*.props'
- '*.slnx'
- 'global.json'
- '.github/workflows/ci.yml'
go:
- 'src/Garage.FeatureFlags/**'
- '.github/workflows/ci.yml'
python:
- 'src/Garage.ChatService/**'
- '.github/workflows/ci.yml'
web:
- 'src/Garage.Web/**'
- '.github/workflows/ci.yml'
build-dotnet:
needs: changes
if: needs.changes.outputs.dotnet == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Cache NuGet packages
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Setup .NET Core
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
with:
global-json-file: global.json
- name: Build with dotnet
run: dotnet build --configuration Release
- name: dotnet format
run: dotnet format --verify-no-changes --no-restore
# - name: Test with dotnet
# run: dotnet test
build-go:
needs: changes
if: needs.changes.outputs.go == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
defaults:
run:
working-directory: src/Garage.FeatureFlags
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: src/Garage.FeatureFlags/go.mod
cache-dependency-path: src/Garage.FeatureFlags/go.sum
- name: Format check
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files are not formatted. Run 'go fmt ./...' to fix."
gofmt -d .
exit 1
fi
- name: Download dependencies
run: go mod download
# go test compiles all packages (including those with no test files) before running,
# so a separate `go build` step would double the compilation time.
- name: Test
run: go test -v ./...
build-python:
needs: changes
if: needs.changes.outputs.python == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
defaults:
run:
working-directory: src/Garage.ChatService
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.14'
allow-prereleases: true
cache: 'pip'
cache-dependency-path: src/Garage.ChatService/requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Check syntax
run: python -m py_compile main.py prompt_loader.py
build-web:
needs: changes
if: needs.changes.outputs.web == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
defaults:
run:
working-directory: src/Garage.Web
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22
cache: 'npm'
cache-dependency-path: src/Garage.Web/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run build