Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): Update large file test to use platform #343

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ env:
github.event.pull_request.head.repo.full_name == github.repository }}

on:
pull_request:
# pull_request:
push:
branches:
- main
- release/[0-9]+.[0-9]+.[0-9]+
release:
types:
- created
# - release/[0-9]+.[0-9]+.[0-9]+
# release:
# types:
# - created
jobs:
lib:
runs-on: ubuntu-latest
Expand Down
144 changes: 12 additions & 132 deletions .github/workflows/large-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,102 +1,15 @@
name: Build, Test, and Deliver Client
name: Large file test

on:
push:
branches:
- main
- feature/large-okish
schedule:
- cron: '0 4 * * 2,4'
jobs:
lib:
large-file-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./lib
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './lib/package-lock.json'
- run: npm ci
- run: npm test
- uses: actions/upload-artifact@v4
with:
name: coverage
path: lib/coverage/
- run: npm audit --omit dev --audit-level moderate
- run: npm run license-check
- run: npm run lint
- run: npm pack
- uses: actions/upload-artifact@v4
with:
name: opentdf-sdk-lib
path: ./lib/opentdf-sdk-*.tgz

cli:
needs:
- lib
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./cli
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './cli/package-lock.json'
- uses: actions/download-artifact@v4
with:
name: opentdf-sdk-lib
path: lib/
- run: npm uninstall @opentdf/sdk && npm ci && npm i ../lib/opentdf-sdk-*.tgz
- run: npm test
- run: npm audit --omit dev --audit-level moderate
- run: npm run license-check
- run: npm run lint
- run: npm pack
- uses: actions/upload-artifact@v4
with:
name: opentdf-ctl
path: ./cli/opentdf-ctl-*.tgz

web-app:
needs:
- lib
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./web-app
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './web-app/package-lock.json'
- uses: actions/download-artifact@v4
with:
name: opentdf-sdk-lib
path: lib/
- run: npm uninstall @opentdf/sdk && npm ci && npm i ../lib/opentdf-sdk-*.tgz
- run: npm install
- run: npm test
- run: npm audit --omit dev --audit-level moderate
- run: npm run license-check
- run: npm run lint
- run: npm pack

backend-roundtrip:
needs:
- cli
- lib
runs-on: ubuntu-latest
defaults:
run:
working-directory: .github/workflows/roundtrip
timeout-minutes: 120
steps:
- uses: actions/checkout@v4
Expand All @@ -105,44 +18,11 @@ jobs:
node-version: '20'
cache: 'npm'
cache-dependency-path: './web-app/package-lock.json'
- uses: actions/download-artifact@v4
with:
name: opentdf-sdk-lib
path: lib/
- uses: actions/download-artifact@v4
with:
name: opentdf-ctl
path: cli
- name: Git clone backend
run: |
git clone https://github.com/opentdf/opentdf.git
- uses: yokawasa/[email protected]
with:
setup-tools: |
kubectl
helm
tilt
# This should be in sync with the minikube-deployed kube version below
kubectl: '1.23.1'
helm: '3.8.0'
tilt: '0.26.2'
- run: |
kubectl version --client
kustomize version
tilt version
- name: start minikube
id: minikube
uses: medyagh/setup-minikube@master
with:
minikube-version: 1.25.1
# This should be in sync with the setup-tools version above
kubernetes-version: 1.23.1
- name: Run tilt ci
env:
#path relative to the quickstart Tiltfile
TEST_SCRIPT: ../../wait-and-test.sh
OPENTDF_INGRESS_HOST_PORT: '5432'
OPENTDF_LOAD_FRONTEND: 'false'
- run: make all && make test
- name: run platform
uses: opentdf/platform/test/start-up-with-containers@main
- env:
PLAYWRIGHT_TESTS_TO_RUN: huge roundtrip
run: |-
tilt ci --file opentdf/quickstart/Tiltfile
./wait-and-test.sh platform
working-directory: .github/workflows/roundtrip
47 changes: 6 additions & 41 deletions .github/workflows/roundtrip/wait-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ _configure_app() {
echo "[ERROR] Couldn't ci roundtrip command line app"
return 1
fi
if ! npm i "../../../cli/opentdf-ctl-${app_version}.tgz"; then
if ! npm i "${ROOT_DIR}/cli/opentdf-ctl-${app_version}.tgz"; then
echo "[ERROR] Couldn't install current command line app"
return 1
fi
return 0
}

if [ $1 = backend ]; then
if [ "$1" = backend ]; then
VITE_PROXY='{"/api":{"target":"http://localhost:5432","xfwd":true},"/auth":{"target":"http://localhost:5432","xfwd":true}}'
VITE_TDF_CFG='{"oidc":{"host":"http://localhost:65432/auth/realms/tdf","clientId":"browsertest"},"kas":"http://localhost:65432/api/kas","reader":"https://secure.virtru.com/start?htmlProtocol=1"}'
else # if [ $1 = platform ]; then
VITE_PROXY='{"/kas":{"target":"http://localhost:8080","xfwd":true},"/auth":{"target":"http://localhost:8888","xfwd":true}}'
VITE_TDF_CFG='{"oidc":{"host":"http://localhost:65432/auth/realms/opentdf","clientId":"browsertest"},"kas":"http://localhost:65432/kas","reader":"https://secure.virtru.com/start?htmlProtocol=1"}'
fi
export VITE_PROXY
export VITE_TDF_CFG
export "VITE_PROXY"
export "VITE_TDF_CFG"

# VITE_PROXY='{"/api":"http://localhost:5432","/auth":"http://localhost:5432"}' VITE_TDF_CFG='{"oidc":{"host":"http://localhost:65432/auth/realms/tdf","clientId":"browsertest"},"kas":"http://localhost:65432/api/kas","reader":"https://secure.virtru.com/start?htmlProtocol=1"}' npm run dev

Expand Down Expand Up @@ -102,46 +103,10 @@ _init_platform() {
echo "[ERROR] unable to cd ${APP_DIR}"
exit 2
fi
svc=github.com/opentdf/platform/service@latest
if [ -f go.work ]; then
svc=github.com/opentdf/platform/service
fi
if ! go run "${svc}" provision keycloak -f "${APP_DIR}/keycloak_data.yaml"; then
echo "[ERROR] unable to provision keycloak"
return 1
fi
if ! ./config-demo-idp.sh; then
echo "[ERROR] unable to provision keycloak"
return 1
fi
if ! ./init-temp-keys.sh; then
echo "[ERROR] unable to initialize keys"
return 1
fi
go run "${svc}" start &>"$output" &
server_pid=$!
echo "Platform pid: $server_pid"
echo "Output: $output"
echo "Wait:"
limit=5
for i in $(seq 1 $limit); do
if grep -q -i 'starting http server' "$output"; then
return 0
fi
if ! ps $server_pid >/dev/null; then
echo "The server died" >&2
cat "${output}"
exit 1
fi
if [[ $i == "$limit" ]]; then
echo "[WARN] Breaking _init_platform loop after ${limit} iterations"
cat "${output}"
break
fi
sleep_for=$((5 + i * i * 2))
echo "[INFO] retrying in ${sleep_for} seconds... ( ${i} / $limit ) ..."
sleep ${sleep_for}
done
}

if ! _configure_app; then
Expand All @@ -154,7 +119,7 @@ if ! _init_webapp; then
exit 2
fi

if [ $1 = platform ]; then
if [ "$1" = platform ]; then
if ! _init_platform; then
echo "[ERROR] Couldn't run platform"
exit 2
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ i:
(cd lib && npm i && npm pack)
for x in $(extras); do (cd $$x && npm uninstall @opentdf/sdk && npm i && npm i ../lib/opentdf-sdk-$(version).tgz) || exit 1; done

all: ci lib/opentdf-sdk-$(version).tgz web-app/opentdf-web-app-$(version).tgz
all: ci lib/opentdf-sdk-$(version).tgz cli/opentdf-ctl-$(version).tgz web-app/opentdf-web-app-$(version).tgz

cli/opentdf-ctl-$(version).tgz: lib/opentdf-sdk-$(version).tgz $(shell find cli -not -path '*/dist*' -and -not -path '*/coverage*' -and -not -path '*/node_modules*')
(cd cli && npm uninstall @opentdf/sdk && npm ci && npm i ../lib/opentdf-sdk-$(version).tgz && npm pack)
Expand Down
Loading