Update builder image, cosign image, golangci-lint #8935
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2021 The Sigstore Authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: CI-Tests | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- '**' | |
- '!**.md' | |
- '!doc/**' | |
- '!**.txt' | |
- '!images/**' | |
- '!LICENSE' | |
- 'test/**' | |
branches: ['main', 'release-*'] | |
pull_request: | |
permissions: read-all | |
env: | |
GO_VERSION: '1.21' | |
jobs: | |
unit-tests: | |
name: Run unit tests | |
permissions: | |
contents: read | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
env: | |
OS: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- name: Run Go tests | |
env: | |
# See #2091 for the issue describing this temp workaround. | |
GODEBUG: x509sha1=1 | |
run: go test -tags=sct -covermode atomic -coverprofile coverage.txt $(go list ./... | grep -v third_party/) | |
- name: Upload Coverage Report | |
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0 | |
with: | |
env_vars: OS | |
- name: Run Go tests w/ `-race` | |
env: | |
# See #2091 for the issue describing this temp workaround. | |
GODEBUG: x509sha1=1 | |
if: ${{ runner.os == 'Linux' }} | |
run: go test -tags=sct -race $(go list ./... | grep -v third_party/) | |
e2e-tests: | |
name: Run e2e tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6 | |
- name: setup kind cluster | |
run: | | |
# Used to test: cosign generate-key-pair k8s://... | |
go install sigs.k8s.io/kind@v0.20.0 | |
kind create cluster | |
- name: Run end-to-end tests | |
run: ./test/e2e_test.sh | |
- name: Collect diagnostics | |
if: ${{ failure() }} | |
uses: chainguard-dev/actions/kind-diag@84c993eaf02da1c325854fb272a4df9184bd80fc # main | |
e2e-windows-powershell-tests: | |
name: Run PowerShell E2E tests | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run e2e_test.ps1 | |
run: ./test/e2e_test.ps1 | |
license-check: | |
name: license boilerplate check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- name: Install addlicense | |
run: go install github.com/google/addlicense@latest | |
- name: Check license headers | |
run: | | |
set -e | |
addlicense -check -l apache -c 'The Sigstore Authors' -ignore "third_party/**" -v * | |
golangci: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: '1.21' | |
check-latest: true | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 | |
with: | |
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | |
version: v1.56 | |
args: --timeout=5m |