fork of https://github.com/sourcegraph/zoekt
1on:
2 push:
3 branches:
4 - main
5 pull_request:
6 workflow_dispatch:
7name: CI
8jobs:
9 test:
10 runs-on: ubuntu-latest
11 container: alpine:edge # latest go pls
12 steps:
13 - name: checkout
14 uses: actions/checkout@v6
15
16 - name: add dependencies
17 run: apk add go git tar
18
19 - name: Cache ctags
20 uses: actions/cache@v5
21 with:
22 path: /usr/local/bin/universal-ctags
23 key: ${{ runner.os }}-ctags-${{ hashFiles('install-ctags-alpine.sh') }}
24
25 - name: Cache Go modules
26 uses: actions/cache@v5
27 with:
28 path: |
29 ~/.cache/go-build
30 ~/go/pkg/mod
31 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
32 restore-keys: |
33 ${{ runner.os }}-go-
34
35 - name: install ctags
36 run: |
37 if [ ! -f /usr/local/bin/universal-ctags ]; then
38 ./install-ctags-alpine.sh
39 fi
40
41 - name: test
42 run: go test ./...
43
44 shellcheck:
45 name: shellcheck
46 runs-on: ubuntu-latest
47 steps:
48 - uses: actions/checkout@v6
49 - name: Run ShellCheck
50 uses: ludeeus/action-shellcheck@2.0.0
51
52 shfmt:
53 name: shfmt
54 runs-on: ubuntu-latest
55 steps:
56 - uses: actions/checkout@v6
57 - uses: reviewdog/action-shfmt@v1.0.4
58 with:
59 filter_mode: "nofilter"
60 fail_on_error: "true"
61 shfmt_flags: "-i 2 -ci -bn"
62
63 lint-protos:
64 name: "buf lint"
65 runs-on: ubuntu-latest
66 steps:
67 # Run `git checkout`
68 - uses: actions/checkout@v6
69 # Install the `buf` CLI
70 - uses: bufbuild/buf-setup-action@v1
71 with:
72 github_token: ${{ secrets.GH_TOKEN }}
73 # Lint your Protobuf sources
74 - run: .github/workflows/buf-lint-check.sh
75
76 format-protos:
77 name: "buf format"
78 runs-on: ubuntu-latest
79 steps:
80 # Run `git checkout`
81 - uses: actions/checkout@v6
82 # Install the `buf` CLI
83 - uses: bufbuild/buf-setup-action@v1
84 with:
85 github_token: ${{ secrets.GH_TOKEN }}
86 # Check to see if the Protobuf sources are formatted
87 - run: .github/workflows/buf-format-check.sh
88
89 generate-protos:
90 name: "buf generate"
91 runs-on: ubuntu-latest
92 steps:
93 # Run `git checkout`
94 - uses: actions/checkout@v6
95 # Install the `buf` CLI
96 - uses: bufbuild/buf-setup-action@v1
97 with:
98 github_token: ${{ secrets.GH_TOKEN }}
99 # Check if the generated code is up-to-date
100 - run: .github/workflows/buf-generate-check.sh
101