docs: Add openfga as another user of slsa-github-generator via Github Actions #6284
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 2023 SLSA 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: unit tests | |
on: | |
push: | |
branches: [main, "*"] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [main] | |
merge_group: | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
pre-submit: | |
# NOTE: this name is used as the status check name and by protected | |
# branches for required status checks. It should have a unique name among | |
# other pre-submits. | |
name: unit tests | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: setup-go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version-file: "go.mod" | |
- name: Set Node.js 16 | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: 16 | |
- name: unit tests | |
run: | | |
sha256sum .github/actions/tscommon/tscommon-0.0.0.tgz | |
make unit-test | |
check-verifier: | |
name: verify slsa-verifier is latest | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
path: generator | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
path: verifier | |
repository: slsa-framework/slsa-verifier | |
- name: Check verifier references | |
shell: bash | |
run: | | |
set -euo pipefail | |
# The first sha in SHA256SUM.md for slsa-verifier-linux-amd64 is the latest verifier release sha | |
expected_sha=$(grep -m 1 -w -o -e '[0-9a-f]\{64\} *slsa-verifier-linux-amd64' verifier/SHA256SUM.md | awk '{ print $1 }') | |
echo "$expected_sha" | |
# The first vX.Y.Z in SHA256SUM.md is the latest verifier release version | |
expected_version=$(grep -e 'v[0-9].[0-9].[0-9]' -o -m 1 -w verifier/SHA256SUM.md | head -1) | |
echo "$expected_version" | |
# Check for expected verifier releases in the builders | |
cd generator | |
error=0 | |
verifier_release_binary_sha256="$(grep -r -e 'VERIFIER_RELEASE_BINARY_SHA256: [0-9a-f]\{64\}' --include=*.yml)" | |
while read -r line ; do | |
sha=$(echo "$line" | grep -o -e '[0-9a-f]\{64\}') | |
file=$(echo "$line" | awk '{print $1;}') | |
if [ "$sha" != "$expected_sha" ]; then | |
echo "SHA out of date in file $file expected $expected_sha" | |
error=1 | |
fi | |
done <<<"${verifier_release_binary_sha256}" | |
verifier_release="$(grep -r -e 'VERIFIER_RELEASE: v[0-9].[0-9].[0-9]' --include=*.yml)" | |
while read -r line ; do | |
version=$(echo "$line" | grep -o -e 'v[0-9].[0-9].[0-9]') | |
file=$(echo "$line" | awk '{print $1;}') | |
if [ "$version" != "$expected_version" ]; then | |
echo "Verifier version out of date in file $file expected $expected_version" | |
error=1 | |
fi | |
done <<<"${verifier_release}" | |
if [ $error -ne 0 ]; then | |
exit 1 | |
fi |