Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Sync Onshape Delta BOM to Baserow
name: Sync Onshape Delta BOM to Supabase

on:
workflow_dispatch:
inputs:
dry_run:
description: Resolve the released BOM without calling Baserow
description: Resolve the released BOM without calling Supabase
required: false
default: false
type: boolean
Expand All @@ -13,16 +13,17 @@ on:
required: false
type: string
repository_dispatch:
types: [bom_sync_delta_baserow]
types: [bom_sync_delta_supabase]

concurrency:
group: >-
onshape-baserow-delta-${{ github.event_name == 'workflow_dispatch' &&
onshape-supabase-delta-${{ github.event_name == 'workflow_dispatch' &&
inputs.dry_run && 'dry-run' || 'production' }}
cancel-in-progress: true

jobs:
sync:
sync-supabase:
name: Sync engineering BOM to Supabase
if: >-
${{ github.event_name != 'workflow_dispatch' ||
(!inputs.dry_run && github.ref_name == github.event.repository.default_branch) }}
Expand All @@ -40,12 +41,12 @@ jobs:
with:
python-version: "3.11"
cache: pip
cache-dependency-path: pre-2027-onshape_ci/requirements.txt
cache-dependency-path: pre-2027-onshape_ci/requirements-sync.txt

- name: Install dependencies
run: pip install -r pre-2027-onshape_ci/requirements.txt
run: pip install -r pre-2027-onshape_ci/requirements-sync.txt

- name: Sync BOM to Baserow
- name: Sync BOM to Supabase
env:
ONSHAPE_ACCESS_KEY: ${{ secrets.ONSHAPE_ACCESS_KEY }}
ONSHAPE_SECRET_KEY: ${{ secrets.ONSHAPE_SECRET_KEY }}
Expand All @@ -54,17 +55,10 @@ jobs:
inputs.onshape_doc_url || secrets.ONSHAPE_DOC_URL_DELTA }}
PARTNUMBER_PREFIXES: "P-190B-26"

BASEROW_API_URL: ${{ vars.BASEROW_API_URL || 'https://api.baserow.io/api' }}
BASEROW_TOKEN: ${{ secrets.BASEROW_TOKEN }}
BASEROW_SYNC_RUNS_TABLE_ID: "1119639"
BASEROW_PARTS_TABLE_ID: "1119641"
BASEROW_REQUIREMENTS_TABLE_ID: "1119642"
BASEROW_OPERATIONS_TABLE_ID: "1169282"
BASEROW_FINISHING_TABLE_ID: "1170619"
BASEROW_STORAGE_LOCATIONS_TABLE_ID: "1119643"
BASEROW_ASSEMBLIES_TABLE_ID: "1119645"
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
SUPABASE_SECRET_KEY: ${{ secrets.SUPABASE_SECRET_KEY }}
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: python pre-2027-onshape_ci/OnshapeToBaserow.py
run: python pre-2027-onshape_ci/OnshapeToSupabase.py

dry-run:
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
Expand All @@ -82,24 +76,24 @@ jobs:
with:
python-version: "3.11"
cache: pip
cache-dependency-path: pre-2027-onshape_ci/requirements.txt
cache-dependency-path: pre-2027-onshape_ci/requirements-sync.txt

- name: Install dependencies
run: pip install -r pre-2027-onshape_ci/requirements.txt
run: pip install -r pre-2027-onshape_ci/requirements-sync.txt

- name: Resolve released BOM without Baserow
- name: Resolve released BOM without Supabase
env:
ONSHAPE_ACCESS_KEY: ${{ secrets.ONSHAPE_ACCESS_KEY }}
ONSHAPE_SECRET_KEY: ${{ secrets.ONSHAPE_SECRET_KEY }}
ONSHAPE_DOC_URL: ${{ inputs.onshape_doc_url || secrets.ONSHAPE_DOC_URL_DELTA }}
PARTNUMBER_PREFIXES: "P-190B-26"
run: >-
python pre-2027-onshape_ci/OnshapeToBaserow.py
python pre-2027-onshape_ci/OnshapeToSupabase.py
--dry-run
--output-json onshape-baserow-dry-run.json
--output-json onshape-supabase-dry-run.json

- name: Upload dry-run records
uses: actions/upload-artifact@v4
with:
name: onshape-baserow-delta-dry-run
path: onshape-baserow-dry-run.json
name: onshape-supabase-delta-dry-run
path: onshape-supabase-dry-run.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Sync Onshape poot_horse BOM to Baserow
name: Sync Onshape poot_horse BOM to Supabase

on:
workflow_dispatch:
inputs:
dry_run:
description: Resolve the released BOM without calling Baserow
description: Resolve the released BOM without calling Supabase
required: false
default: false
type: boolean
Expand All @@ -27,11 +27,11 @@ on:
default: true
type: boolean
repository_dispatch:
types: [bom_sync_poot_horse_baserow]
types: [bom_sync_poot_horse_supabase]

concurrency:
group: >-
onshape-baserow-poot_horse-${{ github.event_name == 'workflow_dispatch' &&
onshape-supabase-poot_horse-${{ github.event_name == 'workflow_dispatch' &&
inputs.dry_run && 'dry-run' || 'production' }}
cancel-in-progress: true

Expand All @@ -46,7 +46,8 @@ env:
https://frc190.onshape.com/documents/e0e5730aacdbb8063c5716e8/w/bbf4b4765261ae88cc30b198/e/81e8a72bfca21fa77a8e2aea

jobs:
sync:
sync-supabase:
name: Sync engineering BOM to Supabase
if: >-
${{ github.event_name != 'workflow_dispatch' ||
(!inputs.dry_run && github.ref_name == github.event.repository.default_branch) }}
Expand All @@ -64,15 +65,15 @@ jobs:
with:
python-version: "3.11"
cache: pip
cache-dependency-path: pre-2027-onshape_ci/requirements.txt
cache-dependency-path: pre-2027-onshape_ci/requirements-sync.txt

- name: Install dependencies
run: pip install -r pre-2027-onshape_ci/requirements.txt
run: pip install -r pre-2027-onshape_ci/requirements-sync.txt

- name: Test Onshape to Baserow sync
run: python -m unittest pre-2027-onshape_ci/test_onshape_to_baserow.py
- name: Test Onshape to Supabase sync
run: python -m unittest pre-2027-onshape_ci/test_onshape_to_supabase.py

- name: Sync BOM to Baserow
- name: Sync BOM to Supabase
env:
ONSHAPE_ACCESS_KEY: ${{ secrets.ONSHAPE_ACCESS_KEY }}
ONSHAPE_SECRET_KEY: ${{ secrets.ONSHAPE_SECRET_KEY }}
Expand All @@ -88,18 +89,11 @@ jobs:
SYNC_CAD_FILES: >-
${{ github.event_name != 'workflow_dispatch' || inputs.sync_cad_files }}

BASEROW_API_URL: ${{ vars.BASEROW_API_URL || 'https://api.baserow.io/api' }}
BASEROW_TOKEN: ${{ secrets.BASEROW_TOKEN }}
BASEROW_SYNC_RUNS_TABLE_ID: "1119639"
BASEROW_PARTS_TABLE_ID: "1119641"
BASEROW_REQUIREMENTS_TABLE_ID: "1119642"
BASEROW_OPERATIONS_TABLE_ID: "1169282"
BASEROW_FINISHING_TABLE_ID: "1170619"
BASEROW_STORAGE_LOCATIONS_TABLE_ID: "1119643"
BASEROW_ASSEMBLIES_TABLE_ID: "1119645"
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
SUPABASE_SECRET_KEY: ${{ secrets.SUPABASE_SECRET_KEY }}
ONSHAPE_EXPORT_TIMEOUT_SECONDS: "600"
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: python pre-2027-onshape_ci/OnshapeToBaserow.py
run: python pre-2027-onshape_ci/OnshapeToSupabase.py

dry-run:
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
Expand All @@ -117,15 +111,15 @@ jobs:
with:
python-version: "3.11"
cache: pip
cache-dependency-path: pre-2027-onshape_ci/requirements.txt
cache-dependency-path: pre-2027-onshape_ci/requirements-sync.txt

- name: Install dependencies
run: pip install -r pre-2027-onshape_ci/requirements.txt
run: pip install -r pre-2027-onshape_ci/requirements-sync.txt

- name: Test Onshape to Baserow sync
run: python -m unittest pre-2027-onshape_ci/test_onshape_to_baserow.py
- name: Test Onshape to Supabase sync
run: python -m unittest pre-2027-onshape_ci/test_onshape_to_supabase.py

- name: Resolve released BOM without Baserow
- name: Resolve released BOM without Supabase
env:
ONSHAPE_ACCESS_KEY: ${{ secrets.ONSHAPE_ACCESS_KEY }}
ONSHAPE_SECRET_KEY: ${{ secrets.ONSHAPE_SECRET_KEY }}
Expand All @@ -136,12 +130,12 @@ jobs:
${{ inputs.subassembly_urls || env.DEFAULT_ONSHAPE_SUBASSEMBLY_URLS }}
SYNC_CAD_FILES: ${{ inputs.sync_cad_files }}
run: >-
python pre-2027-onshape_ci/OnshapeToBaserow.py
python pre-2027-onshape_ci/OnshapeToSupabase.py
--dry-run
--output-json onshape-baserow-dry-run.json
--output-json onshape-supabase-dry-run.json

- name: Upload dry-run records
uses: actions/upload-artifact@v4
with:
name: onshape-baserow-poot-horse-dry-run
path: onshape-baserow-dry-run.json
name: onshape-supabase-poot-horse-dry-run
path: onshape-supabase-dry-run.json
34 changes: 34 additions & 0 deletions .github/workflows/onshape_supabase_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test Onshape Supabase engineering sync

on:
pull_request:
paths:
- 'pre-2027-onshape_ci/**'
- 'supabase/**'
- 'tests/**'
- '.github/workflows/onshape_supabase*'
workflow_dispatch:

permissions:
contents: read

jobs:
offline-tests:
name: Mocked Onshape and isolated PostgreSQL tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Test resolution, dry runs and Supabase transport without live APIs
run: python -m unittest discover -s pre-2027-onshape_ci -p test_onshape_to_supabase.py
- uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install isolated PostgreSQL runtime
run: npm install --no-save --package-lock=false @electric-sql/pglite@0.3.14
- name: Test engineering transaction against contract fixtures
run: node tests/engineering-sync.test.mjs
- name: Test imported duplicates and missing revision markers
run: node tests/imported-sync.test.mjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: Sync Onshape Delta BOM to Baserow
name: Sync Onshape Delta BOM to Supabase

on:
workflow_dispatch: {}
repository_dispatch:
types: [bom_sync_delta_baserow]
types: [bom_sync_delta_supabase]
schedule:
- cron: "7,22,37,52 * * * *"

concurrency:
group: onshape-baserow-delta
group: onshape-supabase-delta
cancel-in-progress: true

jobs:
sync:
sync-supabase:
name: Sync engineering BOM to Supabase
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
Expand All @@ -27,24 +28,19 @@ jobs:
with:
python-version: "3.11"
cache: pip
cache-dependency-path: pre-2027-onshape_ci/requirements.txt
cache-dependency-path: pre-2027-onshape_ci/requirements-sync.txt

- name: Install dependencies
run: pip install -r pre-2027-onshape_ci/requirements.txt
run: pip install -r pre-2027-onshape_ci/requirements-sync.txt

- name: Sync BOM to Baserow
- name: Sync BOM to Supabase
env:
ONSHAPE_ACCESS_KEY: ${{ secrets.ONSHAPE_ACCESS_KEY }}
ONSHAPE_SECRET_KEY: ${{ secrets.ONSHAPE_SECRET_KEY }}
ONSHAPE_DOC_URL: ${{ secrets.ONSHAPE_DOC_URL_DELTA }}
PARTNUMBER_PREFIXES: "P-190B-26"

BASEROW_API_URL: ${{ vars.BASEROW_API_URL || 'https://api.baserow.io/api' }}
BASEROW_TOKEN: ${{ secrets.BASEROW_TOKEN }}
BASEROW_SYNC_RUNS_TABLE_ID: "1119639"
BASEROW_PARTS_TABLE_ID: "1119641"
BASEROW_REQUIREMENTS_TABLE_ID: "1119642"
BASEROW_STORAGE_LOCATIONS_TABLE_ID: "1119643"
BASEROW_ASSEMBLIES_TABLE_ID: "1119645"
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
SUPABASE_SECRET_KEY: ${{ secrets.SUPABASE_SECRET_KEY }}
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: python pre-2027-onshape_ci/OnshapeToBaserow.py
run: python pre-2027-onshape_ci/OnshapeToSupabase.py
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
*.json
/.local-test/
/.venv/
node_modules/
__pycache__/
*.pyc
.env
.env.*
/.idea/.gitignore
/.idea/FRC190_github_root.iml
/.idea/misc.xml
Expand Down
Loading
Loading