Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
97 lines (89 loc) · 3.18 KB
/
Copy pathaction.yml
File metadata and controls
97 lines (89 loc) · 3.18 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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_REGISTRY"
"OCI_REPO1"
)
missing=false
for v in ${required_env_vars[@]}; do
if [[ "${!v}" == "" ]]; then
echo "::error title=Missing variable::Missing required variable ${v}"
missing=true
fi
done
if [[ "${missing}" == "false" ]]; then
exit 0
fi
# fallback to previous variables
required_env_vars=(
"OCI_ROOT_URL"
"OCI_NAMESPACE"
)
missing=false
for v in ${required_env_vars[@]}; do
if [[ "${!v}" == "" ]]; then
echo "::error title=Missing fallback variable::Missing fallback variable ${v}"
missing=true
else
echo "::warning title=Deprecated fallback variable::Variable ${v} has been deprecated"
fi
done
if [[ "${missing}" == "false" ]]; then
exit 0
else
exit 1
fi
- 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 commit version
commit_version="$(basename "${PWD}")"
# Build the conformance binary
CONFORMANCE_VERSION="${commit_version}" OUTPUT_DIRNAME=bin make conformance-cmd
# The spec version is independent of the conformance git commit
echo "oci-spec-version=${OCI_VERSION:-stable}" >> $GITHUB_OUTPUT
# Add bin to the PATH so we can just run "conformance"
echo "${PWD}/bin" >> $GITHUB_PATH
- name: Run OCI distribution-spec conformance binary
shell: bash
id: run-conformance
run: |
set -x
set +e
export OCI_RESULTS_DIR=${OCI_RESULTS_DIR:-.}
conformance
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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: oci-distribution-spec-conformance-results-${{ steps.build-conformance.outputs.oci-spec-version }}
path: |
results.yaml
report.html
junit.xml