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@v3
15
16 - name: add dependencies
17 run: apk add go git tar
18
19 - name: Cache ctags
20 uses: actions/cache@v3
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@v3
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 fuzz-test:
45 name: fuzz test
46 runs-on: ubuntu-latest
47 container: alpine:edge
48 steps:
49 - name: add dependencies
50 run: apk add bash go
51 - uses: jidicula/go-fuzz-action@2d8b802597c47a79764d83dabc27fb672f2fb8d9
52 with:
53 packages: 'github.com/sourcegraph/zoekt' # This is the package where the Protobuf round trip tests are defined
54 fuzz-time: 30s
55 fuzz-minimize-time: 1m
56 go-version: '1.23'
57
58 shellcheck:
59 name: shellcheck
60 runs-on: ubuntu-latest
61 steps:
62 - uses: actions/checkout@v3
63 - name: Run ShellCheck
64 uses: ludeeus/action-shellcheck@1.1.0
65
66 shfmt:
67 name: shfmt
68 runs-on: ubuntu-latest
69 steps:
70 - uses: actions/checkout@v3
71 - uses: reviewdog/action-shfmt@v1.0.2
72 with:
73 filter_mode: "nofilter"
74 fail_on_error: "true"
75 shfmt_flags: "-i 2 -ci -bn"
76
77 lint-protos:
78 name: "buf lint"
79 runs-on: ubuntu-latest
80 steps:
81 # Run `git checkout`
82 - uses: actions/checkout@v2
83 # Install the `buf` CLI
84 - uses: bufbuild/buf-setup-action@v1
85 with:
86 github_token: ${{ secrets.GH_TOKEN }}
87 # Lint your Protobuf sources
88 - run: .github/workflows/buf-lint-check.sh
89
90 format-protos:
91 name: "buf format"
92 runs-on: ubuntu-latest
93 steps:
94 # Run `git checkout`
95 - uses: actions/checkout@v2
96 # Install the `buf` CLI
97 - uses: bufbuild/buf-setup-action@v1
98 with:
99 github_token: ${{ secrets.GH_TOKEN }}
100 # Check to see if the Protobuf sources are formatted
101 - run: .github/workflows/buf-format-check.sh
102
103 generate-protos:
104 name: "buf generate"
105 runs-on: ubuntu-latest
106 steps:
107 # Run `git checkout`
108 - uses: actions/checkout@v2
109 # Install the `buf` CLI
110 - uses: bufbuild/buf-setup-action@v1
111 with:
112 github_token: ${{ secrets.GH_TOKEN }}
113 # Check if the generated code is up-to-date
114 - run: .github/workflows/buf-generate-check.sh
115