X-Test #3122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
schedule: | |
- cron: "30 6 * * *" | |
jobs: | |
cross-client-test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: read | |
env: | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
repository: opentdf/tests | |
path: otdftests # use different name bc other repos might have tests directories | |
- name: Set up Node 20 | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version: "20.x" | |
registry-url: https://npm.pkg.github.com | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b | |
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 WEB SDK ############# | |
- name: Check out web-sdk | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
repository: opentdf/web-sdk | |
path: web-sdk | |
ref: ${{ env.JS_REF }} | |
######## SETUP THE JS CLI ############# | |
- name: build the js cli | |
id: build-web-sdk | |
run: | | |
make clean | |
make cli | |
CLI_NAME=$(cd cli && npm pkg get name | tr -d \") | |
CLI_VERSION=$(cd cli && npm pkg get version | tr -d \") | |
echo "CLI_PATH=cli/$(echo "$CLI_NAME" | tr -d @ | sed s1/1-1)-$CLI_VERSION.tgz" >>$GITHUB_OUTPUT | |
working-directory: web-sdk | |
- name: update packages | |
run: |- | |
npm un @opentdf/cli || true | |
npm ci | |
npm i ../../web-sdk/${{ steps.build-web-sdk.outputs.CLI_PATH }} | |
npm list | |
working-directory: otdftests/xtest | |
######## CHECKOUT GO CLI ############# | |
- name: Check out otdfctl | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 | |
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 -v 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 }}' |