Add sigstore CLI flags --staging and --identity-token #622
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 2024 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: Run unit tests | |
on: | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize] | |
paths-ignore: | |
- '**/*.md' | |
- '*.md' | |
permissions: {} | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
model-signing-unit-tests: | |
name: Signing with Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false # Don't cancel other jobs if one fails | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Hatch | |
uses: pypa/hatch@257e27e51a6a5616ed08a39a408a21c35c9931bc | |
- name: Run unit tests (with coverage report at the end) | |
run: | | |
set -euxo pipefail | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" && "${{ matrix.python-version }}" == "3.11" ]]; then | |
hatch test -c -py ${{ matrix.python-version }} | tee > cov.txt | |
else | |
hatch test -c -py ${{ matrix.python-version }} | |
fi | |
- name: Highlight missing lines | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
run: | | |
set -euxo pipefail | |
awk '/Name/{flag=1; next} /TOTAL/{flag=0; next} flag && !/^[-]+$/' cov.txt | while IFS= read -r line; do | |
# Extract file name and missing ranges | |
file_name=$(echo "$line" | awk '{print $1}') | |
missing_lines=$(echo "$line" | awk '{for (i=5; i<=NF; i++) printf $i " "; print ""}') | |
# Process each range | |
for range in $missing_lines; do | |
# Trim leading and trailing whitespace | |
range=$(echo "$range" | xargs) | |
line_start="" | |
line_end="" | |
message="" | |
if [[ "$range" == *"-"* ]]; then | |
# Split range into start and end | |
line_start=$(echo "$range" | cut -d'-' -f1) | |
line_end=$(echo "$range" | cut -d'-' -f2) | |
message="The following lines were not covered in your tests: $line_start to $line_end" | |
else | |
# Single line number | |
line_start=$range | |
line_end=$range | |
message="The following line was not covered in your tests: $line_start" | |
fi | |
echo "::warning file=$file_name,line=$line_start,endLine=$line_end::$message" | |
done | |
done |