Backport GHSA-vfp6-jrw2-99g9 #8457
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-* | |
- 1.0-fork | |
pull_request: | |
permissions: read-all | |
env: | |
GO_VERSION: 1.19 | |
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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3 | |
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds | |
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.3 | |
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@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3 | |
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 -covermode atomic -coverprofile coverage.txt $(go list ./... | grep -v third_party/) | |
- name: Upload Coverage Report | |
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 | |
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 -race $(go list ./... | grep -v third_party/) | |
e2e-tests: | |
name: Run e2e tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v2.4.0 | |
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds | |
- uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.3 | |
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@c4a742cab115ed795e34d4513e2cf7d472deb55f # v2.1.5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- uses: imjasonh/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.15.0 | |
kind create cluster | |
- name: Run end-to-end tests | |
env: | |
# See #2091 for the issue describing this temp workaround. | |
GODEBUG: x509sha1=1 | |
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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3 | |
- uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3 | |
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@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.3 | |
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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3 | |
- uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3 | |
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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3 | |
- uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3 | |
with: | |
go-version: 1.19 | |
check-latest: true | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@07db5389c99593f11ad7b44463c2d4233066a9b1 # v3 | |
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.49 | |
args: --timeout=5m |