forked from artefactual-labs/ccp
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (88 loc) · 2.56 KB
/
test.yml
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
name: Tests
on:
pull_request:
push:
permissions:
contents: read
jobs:
lint-protos:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1
- uses: bufbuild/buf-lint-action@v1
with:
input: hack/ccp
- uses: bufbuild/buf-push-action@v1
if: github.ref_name == 'ccp'
with:
buf_token: ${{ secrets.BUF_TOKEN }}
input: hack/ccp
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: hack/ccp/go.mod
cache-dependency-path: hack/ccp/go.sum
- name: Get date
id: get-date
shell: bash
run: |
echo "::set-output name=date::$(date -u "+%Y-%m")"
- name: Restore golangci-lint cache
uses: actions/cache@v4
timeout-minutes: 10
continue-on-error: true
with:
path: ${{ runner.temp }}/golangci-lint-cache
key: ${{ runner.os }}-golangci-lint-cache-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-golangci-lint-cache-
- name: Run golangci-lint
run: make lint
env:
GOLANGCI_LINT_CACHE: ${{ runner.temp }}/golangci-lint-cache
working-directory: hack/ccp
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: hack/ccp/go.mod
cache-dependency-path: hack/ccp/go.sum
- name: Run tests
run: go test -race ./...
working-directory: hack/ccp
- name: Run integration tests
run: ./hack/integration.sh
working-directory: hack/ccp
if: false # TODO: investigate; runner fails becaused dir is not watched.
mod:
name: Check that `go mod tidy` is clean
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: hack/ccp/go.mod
cache-dependency-path: hack/ccp/go.sum
- name: Check
run: |
go mod tidy
git diff --name-only --exit-code || (echo "Please run 'go mod tidy'."; exit 1)
working-directory: hack/ccp