-
Notifications
You must be signed in to change notification settings - Fork 207
/
action.yml
70 lines (63 loc) · 2.38 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: oci-distribution-spec-conformance-results-${{ steps.build-conformance.outputs.conformance-version }}
path: |
report.html
junit.xml