-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (141 loc) · 3.91 KB
/
ci.yml
File metadata and controls
148 lines (141 loc) · 3.91 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
go: ${{ steps.filter.outputs.go }}
web: ${{ steps.filter.outputs.web }}
website: ${{ steps.filter.outputs.website }}
docker: ${{ steps.filter.outputs.docker }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
go:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
web:
- 'web/**'
website:
- 'website/**'
docker:
- 'docker/**'
- '**/*.go'
- 'go.mod'
- 'go.sum'
- 'web/**'
- 'website/**'
go-checks:
needs: changes
if: needs.changes.outputs.go == 'true'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: codesearch
POSTGRES_PASSWORD: codesearch
POSTGRES_DB: codesearch
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U codesearch"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Install golangci-lint
uses: golangci/golangci-lint-action@v9
with:
args: ./...
- name: Run go vet
run: make vet
- name: Run tests
env:
CS_DATABASE_URL: postgres://codesearch:codesearch@localhost:5432/codesearch?sslmode=disable
CS_REDIS_ADDR: localhost:6379
run: make test
web-checks:
needs: changes
if: needs.changes.outputs.web == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: cd web && bun install
- name: Lint
run: cd web && bun lint
- name: Test
run: cd web && bun run test:run
website-checks:
needs: changes
if: needs.changes.outputs.website == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: cd website && bun install
- name: Build
run: cd website && bun run build
docker-build:
needs: changes
if: needs.changes.outputs.docker == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- dockerfile: docker/api.Dockerfile
image: code-search-api
- dockerfile: docker/indexer.Dockerfile
image: code-search-indexer
- dockerfile: docker/web.Dockerfile
image: code-search-web
- dockerfile: docker/zoekt.Dockerfile
image: code-search-zoekt
- dockerfile: docker/zoekt-refresh.Dockerfile
image: code-search-zoekt-refresh
- dockerfile: docker/indexer-scip.Dockerfile
image: code-search-indexer-scip
- dockerfile: docker/website.Dockerfile
image: code-search-website
steps:
- uses: actions/checkout@v6
with:
lfs: ${{ matrix.image == 'code-search-website' }}
- uses: docker/setup-buildx-action@v4
- name: Build ${{ matrix.image }}
uses: docker/build-push-action@v7
with:
context: .
file: ${{ matrix.dockerfile }}
push: false
cache-from: type=gha
cache-to: type=gha,mode=max