1
0
mirror of https://github.com/opencontainers/distribution-spec.git synced 2025-04-18 20:04:03 +03:00
distribution-spec/action.yml
Brandon Mitchell f1a874a120
Update GHA uses
- actions/checkout v3 -> v4
- actions/setup-go v3 -> v5
- docker/login-action v2 -> v3
- actions/upload-artifact v3 -> v4
- Replace deprecated set-output with $GITHUB_OUTPUT file

Signed-off-by: Brandon Mitchell <git@bmitch.net>
2025-01-16 16:50:10 -05:00

71 lines
2.4 KiB
YAML

name: OCI Distribution Spec Conformance Tests
description: Validate a registry against the OCI Distribution Spec
author: The Linux Foundation
branding:
color: blue
icon: check-circle
inputs: {}
outputs: {}
runs:
using: composite
steps:
- name: Check required env vars for OCI distribution-spec conformance
shell: bash
id: check-conformance
run: |
set -x
required_env_vars=(
"OCI_ROOT_URL"
"OCI_NAMESPACE"
)
for v in ${required_env_vars[@]}; do
if [[ "${!v}" == "" ]]; then
echo "Error: the following environment variable is required: ${v}"
exit 1
fi
done
- name: Build OCI distribution-spec conformance binary
shell: bash
id: build-conformance
run: |
set -x
# Enter the directory containing the checkout of this action which is surpisingly hard to do (but we did it... #OCI)
cd "$(dirname $(find $(find ~/work/_actions -name distribution-spec -print -quit) -name Makefile -print -quit))"
# The .git folder is not present, but the dirname is the requested action ref, so use this as the conformance version
conformance_version="$(basename "${PWD}")"
echo "conformance-version=${conformance_version}" >> $GITHUB_OUTPUT
# Build the conformance binary
CONFORMANCE_VERSION="${conformance_version}" OUTPUT_DIRNAME=bin make conformance-binary
# Add bin to the PATH so we can just run "conformance.test"
echo "${PWD}/bin" >> $GITHUB_PATH
- name: Run OCI distribution-spec conformance binary
shell: bash
id: run-conformance
run: |
set -x
set +e
conformance.test
conformance_rc="$?"
set -e
if [[ -f report.html ]]; then
echo "Found report.html."
echo "has-report=true" >> $GITHUB_OUTPUT
fi
echo "Conformance return code: ${conformance_rc}"
exit ${conformance_rc}
- name: Upload OCI distribution-spec conformance results as build artifact
if: always() && steps.run-conformance.outputs.has-report == 'true'
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: oci-distribution-spec-conformance-results-${{ steps.build-conformance.outputs.conformance-version }}
path: |
report.html
junit.xml