...
1# Copyright 2022 The Sigstore Authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15name: ci-checks
16
17on:
18 workflow_dispatch:
19 push:
20 branches:
21 - 'main'
22 - 'updates'
23 pull_request:
24
25permissions: read-all
26
27jobs:
28 unit-tests:
29 name: Run unit tests
30 permissions:
31 contents: read
32 runs-on: ubuntu-latest
33
34 env:
35 OS: ubuntu-latest
36
37 steps:
38 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
39 # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
40 - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
41 with:
42 # In order:
43 # * Module download cache
44 # * Build cache (Linux)
45 path: |
46 ~/go/pkg/mod
47 ~/.cache/go-build
48 ~/Library/Caches/go-build
49 %LocalAppData%\go-build
50 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
51 restore-keys: |
52 ${{ runner.os }}-go-
53 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
54 with:
55 go-version-file: './go.mod'
56 check-latest: true
57 - name: Build timestamp CLI
58 run: make timestamp-cli
59 - name: Run Go tests
60 run: go test -covermode atomic -coverprofile coverage.txt $(go list ./... | grep -v third_party/)
61 - name: Upload Coverage Report
62 uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
63 with:
64 env_vars: OS
65 - name: Run Go tests w/ `-race`
66 if: ${{ runner.os == 'Linux' }}
67 run: go test -race $(go list ./... | grep -v third_party/)
68
69 license-check:
70 name: license boilerplate check
71 runs-on: ubuntu-latest
72 steps:
73 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
74 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
75 with:
76 go-version-file: './go.mod'
77 check-latest: true
78 - name: Install addlicense
79 run: go install github.com/google/addlicense@2fe3ee94479d08be985a84861de4e6b06a1c7208 # v1.0.0
80 - name: Check license headers
81 run: |
82 set -e
83 addlicense -check -l apache -c 'The Sigstore Authors' -ignore "third_party/**" -v *
84
85 golangci:
86 name: lint
87 runs-on: ubuntu-latest
88 steps:
89 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
90 - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
91 with:
92 go-version-file: './go.mod'
93 check-latest: true
94
95 - name: golangci-lint
96 uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
97 with:
98 version: v1.54
99 args: --timeout=5m --verbose
View as plain text