Skip to content

Commit 2be3290

Browse files
authored
Merge pull request #72 from Azure-Samples/ci/add-validation-workflows
Add CI validation workflows for infrastructure and samples
2 parents 3a8db32 + fa02fa8 commit 2be3290

2 files changed

Lines changed: 185 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Validate Infrastructure
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'infra/**'
7+
- '.github/workflows/validate-infra.yml'
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- 'infra/**'
13+
- '.github/workflows/validate-infra.yml'
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
validate-bicep:
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 10
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v6
30+
31+
- name: Validate Bicep
32+
run: |
33+
az bicep build --file infra/main.bicep
34+
az bicep build-params --file infra/main.bicepparam
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Validate Samples
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'ai/**'
7+
- '.github/workflows/validate-samples.yml'
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- 'ai/**'
13+
- '.github/workflows/validate-samples.yml'
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
validate-typescript:
24+
name: TypeScript - ${{ matrix.sample }}
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 10
27+
continue-on-error: false
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
sample:
32+
- vector-search-typescript
33+
- vector-search-agent-typescript
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v6
38+
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v6
41+
with:
42+
node-version: '20'
43+
cache: 'npm'
44+
cache-dependency-path: ai/${{ matrix.sample }}/package-lock.json
45+
46+
- name: Install dependencies
47+
working-directory: ai/${{ matrix.sample }}
48+
run: npm ci
49+
50+
- name: Build TypeScript
51+
working-directory: ai/${{ matrix.sample }}
52+
run: npm run build
53+
54+
validate-dotnet:
55+
name: .NET
56+
runs-on: ubuntu-latest
57+
timeout-minutes: 10
58+
continue-on-error: false
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v6
63+
64+
- name: Setup .NET
65+
uses: actions/setup-dotnet@v4
66+
with:
67+
dotnet-version: '8.0.x'
68+
69+
- name: Build solution
70+
run: dotnet build documentdb-samples.sln
71+
72+
validate-go:
73+
name: Go - ${{ matrix.sample }}
74+
runs-on: ubuntu-latest
75+
timeout-minutes: 10
76+
continue-on-error: false
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
sample:
81+
- vector-search-go
82+
- vector-search-agent-go
83+
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v6
87+
88+
- name: Setup Go
89+
uses: actions/setup-go@v6
90+
with:
91+
go-version: '1.24'
92+
cache-dependency-path: ai/${{ matrix.sample }}/go.sum
93+
94+
- name: Validate Go
95+
working-directory: ai/${{ matrix.sample }}
96+
run: |
97+
# Check if src/ has multiple main() declarations (independent programs sharing utils)
98+
if [ -d "src" ] && [ "$(grep -rl '^func main()' src/*.go 2>/dev/null | wc -l)" -gt 1 ]; then
99+
cd src
100+
for f in $(grep -l '^func main()' *.go); do
101+
echo "Building $f + utils.go"
102+
go build -o /dev/null "$f" utils.go
103+
done
104+
else
105+
go build ./...
106+
fi
107+
108+
validate-python:
109+
name: Python
110+
runs-on: ubuntu-latest
111+
timeout-minutes: 10
112+
continue-on-error: false
113+
114+
steps:
115+
- name: Checkout code
116+
uses: actions/checkout@v6
117+
118+
- name: Setup Python
119+
uses: actions/setup-python@v6
120+
with:
121+
python-version: '3.11'
122+
123+
- name: Install dependencies
124+
working-directory: ai/vector-search-python
125+
run: pip install -r requirements.txt
126+
127+
- name: Validate Python syntax
128+
working-directory: ai/vector-search-python
129+
run: |
130+
find . -name "*.py" -exec python -m py_compile {} +
131+
132+
validate-java:
133+
name: Java
134+
runs-on: ubuntu-latest
135+
timeout-minutes: 10
136+
continue-on-error: false
137+
138+
steps:
139+
- name: Checkout code
140+
uses: actions/checkout@v6
141+
142+
- name: Setup Java
143+
uses: actions/setup-java@v4
144+
with:
145+
distribution: 'temurin'
146+
java-version: '21'
147+
cache: 'maven'
148+
149+
- name: Compile Java
150+
working-directory: ai/vector-search-java
151+
run: mvn compile -DskipTests

0 commit comments

Comments
 (0)