@@ -7,5 +7,64 @@ branding:
77inputs : {}
88outputs : {}
99runs :
10- using : docker
11- image : " docker://ghcr.io/opencontainers/distribution-spec/conformance:v1.0.0@sha256:6302582c3b35169f7846282ad5b81471cd8814f30f7a958030e04fd82b19e17f"
10+ using : composite
11+ steps :
12+ - name : Check required env vars for OCI distribution-spec conformance
13+ shell : bash
14+ id : check-conformance
15+ run : |
16+ set -x
17+ required_env_vars=(
18+ "OCI_ROOT_URL"
19+ "OCI_NAMESPACE"
20+ )
21+ for v in ${required_env_vars[@]}; do
22+ if [[ "${!v}" == "" ]]; then
23+ echo "Error: the following environment variable is required: ${v}"
24+ exit 1
25+ fi
26+ done
27+
28+ - name : Build OCI distribution-spec conformance binary
29+ shell : bash
30+ id : build-conformance
31+ run : |
32+ set -x
33+
34+ # Enter the directory containing the checkout of this action which is surpisingly hard to do (but we did it... #OCI)
35+ cd "$(dirname $(find $(find ~/work/_actions -name distribution-spec -print -quit) -name Makefile -print -quit))"
36+
37+ # The .git folder is not present, but the dirname is the requested action ref, so use this as the conformance version
38+ conformance_version="$(basename "${PWD}")"
39+ echo "conformance-version=${conformance_version}" >> $GITHUB_OUTPUT
40+
41+ # Build the conformance binary
42+ CONFORMANCE_VERSION="${conformance_version}" OUTPUT_DIRNAME=bin make conformance-binary
43+
44+ # Add bin to the PATH so we can just run "conformance.test"
45+ echo "${PWD}/bin" >> $GITHUB_PATH
46+
47+ - name : Run OCI distribution-spec conformance binary
48+ shell : bash
49+ id : run-conformance
50+ run : |
51+ set -x
52+ set +e
53+ conformance.test
54+ conformance_rc="$?"
55+ set -e
56+ if [[ -f report.html ]]; then
57+ echo "Found report.html."
58+ echo "has-report=true" >> $GITHUB_OUTPUT
59+ fi
60+ echo "Conformance return code: ${conformance_rc}"
61+ exit ${conformance_rc}
62+
63+ - name : Upload OCI distribution-spec conformance results as build artifact
64+ if : always() && steps.run-conformance.outputs.has-report == 'true'
65+ uses : actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
66+ with :
67+ name : oci-distribution-spec-conformance-results-${{ steps.build-conformance.outputs.conformance-version }}
68+ path : |
69+ report.html
70+ junit.xml
0 commit comments