-
Notifications
You must be signed in to change notification settings - Fork 2
253 lines (237 loc) · 8.12 KB
/
xtest.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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: X-Test
on:
pull_request:
workflow_call:
inputs:
platform-ref:
required: false
type: string
default: main
otdfctl-ref:
required: false
type: string
default: main
js-ref:
required: false
type: string
default: main
java-ref:
required: false
type: string
default: main
tests-ref:
required: false
type: string
default: main
schedule:
- cron: "30 6 * * *"
jobs:
cross-client-test:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
env:
TESTS_REF: "${{ inputs.tests-ref || 'main' }}"
PLATFORM_REF: "${{ inputs.platform-ref || 'main' }}"
JS_REF: "${{ inputs.js-ref || 'main' }}"
OTDFCTL_REF: "${{ inputs.otdfctl-ref || 'main' }}"
JAVA_REF: "${{ inputs.java-ref || 'main' }}"
steps:
- uses: actions/checkout@v3
with:
repository: opentdf/tests
path: otdftests # use different name bc other repos might have tests directories
ref: ${{ env.TESTS_REF }}
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: https://npm.pkg.github.com
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: bufbuild/buf-setup-action@2211e06e8cf26d628cda2eea15c95f8c42b080b3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@5896cecc08fd8a1fbdfaf517e29b571164b031f7
with:
java-version: "11"
distribution: "adopt"
server-id: github
######## SPIN UP PLATFORM BACKEND #############
- name: Check out and start up platform with deps/containers
id: run-platform
uses: opentdf/platform/test/start-up-with-containers@main
with:
platform-ref: ${{ env.PLATFORM_REF }}
######## CHECKOUT CLIENT-WEB #############
- name: Check out client-web
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
repository: opentdf/client-web
path: client-web
ref: ${{ env.JS_REF }}
######## SETUP THE JS CLI #############
- name: build the js cli
run: |
make clean
CLIENT_VERSION=$(cd lib && npm pkg get version | tr -d \")
make lib/opentdf-client-$CLIENT_VERSION.tgz
rm -rf */node_modules
cd cli
npm uninstall @opentdf/client && npm ci && npm i ../lib/opentdf-client-*.tgz && npm i
npm pack
working-directory: client-web
- name: update packages
run: |-
npm ci
npm install ../../client-web/cli/opentdf-cli-*.tgz
npm list
working-directory: otdftests/xtest
######## CHECKOUT GO CLI #############
- name: Check out otdfctl
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
repository: opentdf/otdfctl
path: otdfctl
ref: ${{ env.OTDFCTL_REF }}
######## SETUP THE GO CLI #############
- name: Prepare go cli
run: |-
for m in lib/fixtures lib/ocrypto protocol/go sdk; do
go mod edit -replace github.com/opentdf/platform/${m}=../${{ steps.run-platform.outputs.platform-working-dir }}/${m}
done
go mod tidy
go build .
cp ./otdfctl ../otdftests/xtest/sdk/go/otdfctl
working-directory: otdfctl
####### CHECKOUT JAVA SDK ##############
- name: Check out java-sdk
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
repository: opentdf/java-sdk
path: java-sdk
ref: ${{ env.JAVA_REF }}
####### SETUP JAVA CLI ##############
- name: Build java cli
run: |
mvn --batch-mode clean install -DskipTests
env:
BUF_INPUT_HTTPS_USERNAME: opentdf-bot
BUF_INPUT_HTTPS_PASSWORD: ${{ secrets.PERSONAL_ACCESS_TOKEN_OPENTDF }}
working-directory: java-sdk
- name: Move java cli to xtest
run: |-
cp cmdline/target/cmdline.jar ../otdftests/xtest/sdk/java/cmdline.jar
working-directory: java-sdk
######## RUN THE TESTS #############
- name: Install test dependencies
run: |-
pip install -r requirements.txt
working-directory: otdftests/xtest
- name: Validate xtests
if: ${{ !inputs }}
run: |-
pytest test_nano.py test_self.py
working-directory: otdftests/xtest
- name: Run xtests
run: |-
pytest test_tdfs.py
working-directory: otdftests/xtest
env:
PLATFORM_DIR: '../../${{ steps.run-platform.outputs.platform-working-dir }}'
######## ATTRIBUTE BASED CONFIGURATION #############
- name: Start additional kas
uses: opentdf/platform/test/start-additional-kas@main
with:
kas-port: 8181
kas-name: alpha
- name: Start additional kas
uses: opentdf/platform/test/start-additional-kas@main
with:
kas-port: 8282
kas-name: beta
- name: Start additional kas
uses: opentdf/platform/test/start-additional-kas@main
with:
kas-port: 8383
kas-name: gamma
- name: Start additional kas
uses: opentdf/platform/test/start-additional-kas@main
with:
kas-port: 8484
kas-name: delta
- name: Run attribute based configuration tests
run: |-
pytest test_abac.py
working-directory: otdftests/xtest
env:
PLATFORM_DIR: '../../${{ steps.run-platform.outputs.platform-working-dir }}'
###### TODO: move these unbound tests to v2 platform
# unbound-test-js:
# timeout-minutes: 60
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: xtest
# permissions:
# contents: read
# packages: read
# strategy:
# matrix:
# kasversion: [ python-kas, go-kas ]
# steps:
# - uses: actions/checkout@v3
# - name: Set kas-related environment variable
# shell: bash
# run: echo "KAS_VERSION=${{ matrix.kasversion }}" >> $GITHUB_ENV
# - name: Set up Node 18
# uses: actions/setup-node@v3
# with:
# node-version: "18.x"
# registry-url: https://npm.pkg.github.com
# - name: Set up Python 3.10
# uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# # todo: install and activate virtual env for python?
# - name: update packages
# run: |-
# npm ci
# npm install @opentdf/cli@${{ github.event.client_payload.version }} @opentdf/client@${{ github.event.client_payload.version }}
# npm list
# pip3 install -r requirements.txt
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - uses: yokawasa/[email protected]
# with:
# setup-tools: |
# kubectl
# helm
# tilt
# # This should be in sync with the minikube-deployed kube version below
# kubectl: "1.24.1"
# helm: "3.9.2"
# tilt: "0.31.2"
# - run: |
# kubectl version --client
# kustomize version
# tilt version
# - name: start minikube
# id: minikube
# uses: medyagh/setup-minikube@master
# with:
# minikube-version: 1.26.0
# # This should be in sync with the setup-tools version above
# kubernetes-version: 1.24.1
# - name: Run tilt
# run: |-
# [[ -z "${{github.event.inputs.backendVersion}}" ]] && export BACKEND_LATEST_VERSION=$(skopeo list-tags docker://ghcr.io/opentdf/charts/backend \
# | python3 -c "import sys, json; sys.stdout.write([tag for tag in json.load(sys.stdin)['Tags'] if not tag.endswith('.sig')][-1])") || export BACKEND_LATEST_VERSION="${{github.event.inputs.backendVersion}}"
# echo "Testing Backend [$BACKEND_LATEST_VERSION]">>$GITHUB_STEP_SUMMARY
# kubectl version
# tilt ci -f Tiltfile.unbound-js-sdk