-
Notifications
You must be signed in to change notification settings - Fork 103
157 lines (146 loc) · 4.83 KB
/
pr-tests.yaml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Tests
on:
pull_request:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
- name: Install Protoc
uses: arduino/setup-protoc@v2
- name: Cache compilation artefacts
uses: mozilla-actions/[email protected]
- name: Cargo fmt
run: cargo fmt --all -- --check
- name: Run trow-server test suite
run: cargo test -p trow-server
- name: Run Trow test suite
run: cargo test -p trow
- name: Smoke test
run: cargo test -- --ignored
build:
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
outputs:
container-image: ${{ steps.meta.outputs.tags }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: dtolnay/rust-toolchain@stable
- name: Install Protoc
uses: arduino/setup-protoc@v2
- name: Cache compilation artefacts
uses: mozilla-actions/[email protected]
- name: Build
run: |
cargo build
mv target/debug/trow trow
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export container image
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile.debug
tags: trow:onpr
outputs: type=docker,dest=/tmp/trow_image.tar.zst
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: "trow-image-${{ github.event.pull_request.number }}"
path: /tmp/trow_image.tar.zst
oci-conformance:
runs-on: ubuntu-latest
needs: build
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
timeout-minutes: 10
steps:
- name: Download container image artifact
uses: actions/download-artifact@v3
with:
name: "trow-image-${{ github.event.pull_request.number }}"
path: /tmp
- name: Load and run image
id: start-container-image
run: |
docker load --input /tmp/trow_image.tar.zst
ID=$(docker run -d --name trow -p 8000:8000 trow:onpr)
IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ID)
echo "container-ip=$IP" >> $GITHUB_OUTPUT
- name: Test connectivity
run: curl "http://${{ steps.start-container-image.outputs.container-ip }}:8000"
- name: Run OCI Distribution Spec conformance tests
uses: opencontainers/[email protected]
env:
OCI_ROOT_URL: "http://${{ steps.start-container-image.outputs.container-ip }}:8000"
OCI_NAMESPACE: oci-conformance/distribution-test
OCI_TEST_PULL: 1
OCI_TEST_PUSH: 1
OCI_TEST_CONTENT_DISCOVERY: 1
OCI_TEST_CONTENT_MANAGEMENT: 1
OCI_HIDE_SKIPPED_WORKFLOWS: 0
OCI_DEBUG: 0
helm-chart-validation:
runs-on: ubuntu-latest
needs: build
env:
IMAGE: ${{ needs.build.outputs.container-image }}
timeout-minutes: 10
steps:
- name: Download container image artifact
uses: actions/download-artifact@v3
with:
name: "trow-image-${{ github.event.pull_request.number }}"
path: /tmp
- name: Checkout
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create kind cluster
uses: helm/[email protected]
with:
config: .github/workflows/config/kind.yaml
cluster_name: kind
- name: Install Ingress
run: |
.github/workflows/config/install-kind-ingress.sh
kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
- name: Sideload Trow image
run: |
kind load image-archive /tmp/trow_image.tar.zst
- name: Helm Install Trow
run: |
helm install trow-test -f .github/workflows/config/values.yaml charts/trow/
- name: Pull and Tag Docker Image
run: |
docker pull nginx:alpine
docker tag nginx:alpine 127.0.0.1/test/nginx:alpine
- name: Push to Trow
run: |
kubectl wait pod/trow-test-0 --for condition=ready --timeout=300s
docker push 127.0.0.1/test/nginx:alpine
typos:
name: Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/[email protected]