| 1 |
# |
| 2 |
# Copyright 2021 The Sigstore Authors. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
# you may not use this file except in compliance with the License. |
| 6 |
# You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
|
| 16 |
name: test |
| 17 |
|
| 18 |
on: |
| 19 |
push: |
| 20 |
branches: |
| 21 |
- main |
| 22 |
pull_request: |
| 23 |
branches: |
| 24 |
- main |
| 25 |
|
| 26 |
permissions: {} |
| 27 |
|
| 28 |
jobs: |
| 29 |
unit_test: |
| 30 |
name: unit tests |
| 31 |
runs-on: ubuntu-latest |
| 32 |
|
| 33 |
permissions: |
| 34 |
contents: read |
| 35 |
|
| 36 |
strategy: |
| 37 |
matrix: |
| 38 |
go-version: |
| 39 |
- 1.25.x |
| 40 |
|
| 41 |
steps: |
| 42 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 43 |
with: |
| 44 |
persist-credentials: false |
| 45 |
|
| 46 |
- name: Set up Go |
| 47 |
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 |
| 48 |
with: |
| 49 |
go-version: ${{ matrix.go-version }} |
| 50 |
check-latest: true |
| 51 |
cache: false |
| 52 |
|
| 53 |
- name: Cache Modules |
| 54 |
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 55 |
with: |
| 56 |
path: ~/go/pkg/mod |
| 57 |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 58 |
restore-keys: | |
| 59 |
${{ runner.os }}-go- |
| 60 |
|
| 61 |
- run: | |
| 62 |
for submodule in \ |
| 63 |
. \ |
| 64 |
pkg/signature/kms/aws \ |
| 65 |
pkg/signature/kms/azure \ |
| 66 |
pkg/signature/kms/gcp \ |
| 67 |
pkg/signature/kms/hashivault; do |
| 68 |
pushd $submodule |
| 69 |
|
| 70 |
go mod tidy |
| 71 |
go build -v ./... |
| 72 |
go test -v ./... |
| 73 |
|
| 74 |
popd |
| 75 |
done |
| 76 |
|
| 77 |
- name: Ensure no files were modified as a result of the build |
| 78 |
run: git update-index --refresh && git diff-index --quiet HEAD -- || git diff --exit-code |