-
Notifications
You must be signed in to change notification settings - Fork 4
101 lines (101 loc) · 3.67 KB
/
oci-dist-spec-content-management.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
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
98
99
100
101
name: OCI Distribution Spec - Content Management
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)
required: false
default: false
concurrency:
group: content-management-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
PGUSER: postgres
POSTGRES_DB: open_registry
POSTGRES_PASSWORD: Qwerty@123
POSTGRES_USER: postgres
jobs:
conformance:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
PGUSER: postgres
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Qwerty@123
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports: [5432:5432]
steps:
- run: sudo snap install --edge --classic just
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Build and configure OpenRegistry container image
run: |
IP=`hostname -I | awk '{print $1}'`
echo "IP=$IP" >> $GITHUB_ENV
echo "OCI_ROOT_URL=http://$IP:5000" >> $GITHUB_ENV
cp config.example.yaml config.yaml
IP=$IP yq e -i '.database.host = env(IP)' config.yaml
yq e -i '.dfs.mock.enabled = "true"' config.yaml
yq e -i '.dfs.mock.type = "FS"' config.yaml
go mod download
go build
just certs
./OpenRegistry migrations init \
--admin-db="postgres" \
--admin-db-username="postgres" \
--admin-db-password=${POSTGRES_PASSWORD} \
--database=${POSTGRES_DB} \
--host=${IP} \
--password=${POSTGRES_PASSWORD} \
--insecure=true
nohup ./OpenRegistry start >> openregistry.log &
sleep 3
curl -XPOST -d '{"email": "[email protected]", "username": "johndoe", "password": "Qwerty@123"}' "http://${IP}:5000/auth/signup"
cat openregistry.log
- name: Run OCI Distribution Spec conformance tests
if: always()
run: |
git clone https://github.com/opencontainers/distribution-spec.git
pushd distribution-spec/conformance
git checkout v1.1.0
go test -c
./conformance.test
popd
mkdir -p .out/ && mv {distribution-spec/conformance/report.html,distribution-spec/conformance/junit.xml} .out/
env:
OCI_ROOT_URL: ${{ env.OCI_ROOT_URL }}
OCI_USERNAME: johndoe
OCI_PASSWORD: Qwerty@123
OCI_NAMESPACE: johndoe/distribution-test
OCI_TEST_PUSH: 1
OCI_HIDE_SKIPPED_WORKFLOWS: 1
OCI_CROSSMOUNT_NAMESPACE: johndoe/distribution-cross-mount
OCI_DEBUG: 0
- name: Setup tmate session if mode is debug and OpenRegistry or OCI Tests Fail
uses: mxschmitt/action-tmate@v3
if: ${{ always() && (github.event_name == 'workflow_dispatch') && inputs.debug_enabled }}
- name: Set output report name
id: vars
run: echo "short_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload test results zip as build artifact
uses: actions/upload-artifact@v4
with:
name: oci-distribution-content-management-report-${{ steps.vars.outputs.short_commit_hash }}
path: |
.out/report.html
.out/junit.xml
if: always()