Skip to content
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
17 changes: 14 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
run: >-
docker run --rm -v "$PWD:/mnt" --workdir "/mnt" "koalaman/shellcheck:v0.8.0" --color=always \
$(find . -type f -exec grep -m1 -l -E '^#!.*sh.*' {} \; | grep -v '/.git/')
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.14'
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
with:
Expand All @@ -35,3 +32,17 @@ jobs:
uv run ruff format --check .
uv run pyright
working-directory: xtest
- name: Lint otdf-local
run: |
uv sync
uv run ruff check .
uv run ruff format --check .
uv run pyright
working-directory: otdf-local
- name: Lint otdf-sdk-mgr
run: |
uv sync
uv run ruff check .
uv run ruff format --check .
uv run pyright
working-directory: otdf-sdk-mgr
47 changes: 25 additions & 22 deletions .github/workflows/xtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,10 @@ jobs:
path: otdf-sdk
persist-credentials: false
repository: opentdf/tests
sparse-checkout: xtest/sdk
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.14"
- run: |-
pip install -r scripts/requirements.txt
working-directory: otdf-sdk/xtest/sdk
sparse-checkout: |
xtest/sdk
otdf-sdk-mgr
- uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- id: version-info
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
with:
Expand All @@ -134,8 +131,7 @@ jobs:
const { execSync } = require('child_process');
const path = require('path');

const workingDir = path.join(process.env.GITHUB_WORKSPACE, 'otdf-sdk/xtest/sdk');
const resolveVersionScript = path.join(workingDir, 'scripts/resolve-version.py');
const sdkMgrDir = path.join(process.env.GITHUB_WORKSPACE, 'otdf-sdk/otdf-sdk-mgr');
const defaultTags = process.env.DEFAULT_TAGS || 'main';
core.setOutput('default-tags', defaultTags);

Expand All @@ -150,7 +146,7 @@ jobs:

for (const [sdkType, ref] of Object.entries(refs)) {
try {
const output = execSync(`python3 ${resolveVersionScript} ${sdkType} ${ref}`, { cwd: workingDir }).toString();
const output = execSync(`uv run --project ${sdkMgrDir} otdf-sdk-mgr versions resolve ${sdkType} ${ref}`, { cwd: sdkMgrDir }).toString();
const ojson = JSON.parse(output);
if (!!ojson.err) {
throw new Error(ojson.err);
Expand Down Expand Up @@ -247,10 +243,8 @@ jobs:
extra-keys: ${{ steps.load-extra-keys.outputs.EXTRA_KEYS }}
log-type: json

- name: Set up Python 3.14
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.14"
- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- uses: bufbuild/buf-action@8f4a1456a0ab6a1eb80ba68e53832e6fcfacc16c # v1.3.0
with:
setup_only: true
Expand All @@ -271,13 +265,15 @@ jobs:

######### CHECKOUT JS CLI #############
- name: Configure js-sdk
id: configure-js
uses: ./otdftests/xtest/setup-cli-tool
with:
path: otdftests/xtest/sdk
sdk: js
version-info: "${{ needs.resolve-versions.outputs.js }}"

- name: Cache npm
if: fromJson(steps.configure-js.outputs.heads)[0] != null
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ~/.npm
Expand All @@ -288,6 +284,7 @@ jobs:
######## SETUP THE JS CLI #############
- name: build and setup the web-sdk cli
id: build-web-sdk
if: fromJson(steps.configure-js.outputs.heads)[0] != null
run: |
make
working-directory: otdftests/xtest/sdk/js
Expand All @@ -302,6 +299,7 @@ jobs:
version-info: "${{ needs.resolve-versions.outputs.go }}"

- name: Cache Go modules
if: fromJson(steps.configure-go.outputs.heads)[0] != null
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: |
Expand All @@ -313,13 +311,14 @@ jobs:

- name: Resolve otdfctl heads
id: resolve-otdfctl-heads
if: fromJson(steps.configure-go.outputs.heads)[0] != null
run: |-
echo "OTDFCTL_HEADS=$OTDFCTL_HEADS" >> "$GITHUB_ENV"
env:
OTDFCTL_HEADS: ${{ steps.configure-go.outputs.heads }}

- name: Replace otdfctl go.mod packages, but only at head version of platform
if: env.FOCUS_SDK == 'go' && contains(fromJSON(needs.resolve-versions.outputs.heads), matrix.platform-tag)
if: fromJson(steps.configure-go.outputs.heads)[0] != null && env.FOCUS_SDK == 'go' && contains(fromJSON(needs.resolve-versions.outputs.heads), matrix.platform-tag)
env:
PLATFORM_WORKING_DIR: ${{ steps.run-platform.outputs.platform-working-dir }}
run: |-
Expand All @@ -339,20 +338,23 @@ jobs:

######## SETUP THE GO CLI #############
- name: Prepare go cli
if: fromJson(steps.configure-go.outputs.heads)[0] != null
run: |-
make
working-directory: otdftests/xtest/sdk/go

####### CHECKOUT JAVA SDK ##############

- name: Configure java-sdk
id: configure-java
uses: ./otdftests/xtest/setup-cli-tool
with:
path: otdftests/xtest/sdk
sdk: java
version-info: "${{ needs.resolve-versions.outputs.java }}"

- name: Cache Maven repository
if: fromJson(steps.configure-java.outputs.heads)[0] != null
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
with:
path: ~/.m2/repository
Expand All @@ -361,8 +363,10 @@ jobs:
maven-${{ runner.os }}-

- name: pre-release protocol buffers for java-sdk
if: |
(env.FOCUS_SDK == 'go' || env.FOCUS_SDK == 'java') && contains(fromJSON(needs.resolve-versions.outputs.heads), matrix.platform-tag)
if: >-
fromJson(steps.configure-java.outputs.heads)[0] != null
&& (env.FOCUS_SDK == 'go' || env.FOCUS_SDK == 'java')
&& contains(fromJSON(needs.resolve-versions.outputs.heads), matrix.platform-tag)
run: |-
echo "Replacing .env files for java-sdk..."
echo "Platform tag: $platform_tag"
Expand All @@ -384,6 +388,7 @@ jobs:

####### SETUP JAVA CLI ##############
- name: Prepare java cli
if: fromJson(steps.configure-java.outputs.heads)[0] != null
run: |
make
working-directory: otdftests/xtest/sdk/java
Expand Down Expand Up @@ -440,8 +445,6 @@ jobs:
fi
working-directory: ${{ steps.run-platform.outputs.platform-working-dir }}

- name: Install uv
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
- name: Install test dependencies
run: uv sync
working-directory: otdftests/xtest
Expand All @@ -465,7 +468,7 @@ jobs:
- name: Run all standard xtests
if: ${{ env.FOCUS_SDK == 'all' }}
run: |-
uv run pytest -n auto --dist loadscope --html=test-results/sdk-${FOCUS_SDK}-${PLATFORM_TAG}.html --self-contained-html --sdks-encrypt "${ENCRYPT_SDK}" -ra -v test_tdfs.py test_policytypes.py
uv run pytest -n auto --dist worksteal --html=test-results/sdk-${FOCUS_SDK}-${PLATFORM_TAG}.html --self-contained-html --sdks-encrypt "${ENCRYPT_SDK}" -ra -v test_tdfs.py test_policytypes.py
working-directory: otdftests/xtest
env:
PLATFORM_DIR: "../../${{ steps.run-platform.outputs.platform-working-dir }}"
Expand All @@ -475,7 +478,7 @@ jobs:
- name: Run xtests focusing on a specific SDK
if: ${{ env.FOCUS_SDK != 'all' }}
run: |-
uv run pytest -n auto --dist loadscope --html=test-results/sdk-${FOCUS_SDK}-${PLATFORM_TAG}.html --self-contained-html --sdks-encrypt "${ENCRYPT_SDK}" -ra -v --focus "$FOCUS_SDK" test_tdfs.py test_policytypes.py
uv run pytest -n auto --dist worksteal --html=test-results/sdk-${FOCUS_SDK}-${PLATFORM_TAG}.html --self-contained-html --sdks-encrypt "${ENCRYPT_SDK}" -ra -v --focus "$FOCUS_SDK" test_tdfs.py test_policytypes.py
working-directory: otdftests/xtest
env:
PLATFORM_DIR: "../../${{ steps.run-platform.outputs.platform-working-dir }}"
Expand Down Expand Up @@ -575,7 +578,7 @@ jobs:
-ra
-v
--numprocesses auto
--dist loadscope
--dist worksteal
--html test-results/attributes-${FOCUS_SDK}-${PLATFORM_TAG}.html
--self-contained-html
--audit-log-dir test-results/audit-logs
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ xtest/sdk/java/cmdline.jar
/xtest/java-sdk/
/xtest/sdk/go/otdfctl
/xtest/otdfctl/
/xtest/logs/

/tmp/
20 changes: 20 additions & 0 deletions .shfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Language variant
language_dialect: bash

# Indentation (2 spaces)
indent: 2

# Binary operators at start of line
binary_next_line: false

# Switch case indentation
switch_case_indent: true

# Redirect operators with space
space_redirects: true

# Keep column alignment
keep_padding: true

# Function brace on same line
function_next_line: false
Loading
Loading