Sharded Targets #1462
This file contains hidden or 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
| # Copyright 2026 OpenC3, Inc. | |
| # All Rights Reserved. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| # See LICENSE.md for more details. | |
| # This file may also be used under the terms of a commercial license | |
| # if purchased from OpenC3, Inc. | |
| name: Frontend Generator Tests | |
| # Only run on a push to main to avoid running for all the dependabot PRs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - "**" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| OPENC3_API_PASSWORD: password | |
| permissions: | |
| contents: read | |
| jobs: | |
| frontend-generators: | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 24 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 | |
| with: | |
| version: 9 | |
| - name: openc3.sh build | |
| # This `shell` line is required to get around a known issue: https://github.com/actions/runner/issues/241#issuecomment-745902718 | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: ./openc3.sh build | |
| - name: openc3.sh run | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| ! docker ps | grep openc3 | |
| ./openc3.sh run | |
| sleep 10s | |
| docker ps | grep openc3 | |
| # Test Vue.js tool generation and build | |
| - name: Generate and build Vue.js tool | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| # Generate plugin | |
| ./openc3.sh cli generate plugin tool-vue-test --ruby | |
| cd openc3-cosmos-tool-vue-test | |
| # Generate Vue tool | |
| ../openc3.sh cli generate tool_vue 'Test Vue Tool' --ruby | |
| # Verify tool structure created | |
| test -f package.json | |
| test -f vite.config.js | |
| test -f src/App.vue | |
| test -d src/tools/testvuetool | |
| test -f src/tools/testvuetool/testvuetool.vue | |
| # Verify tool was added to plugin.txt | |
| grep -q 'TOOL testvuetool "Test Vue Tool"' plugin.txt | |
| grep -q 'INLINE_URL main.js' plugin.txt | |
| # Verify package.json has required scripts | |
| grep -q '"build"' package.json | |
| grep -q '"serve"' package.json | |
| # Build plugin (skip --frozen-lockfile for fresh plugins, keep --ignore-scripts) | |
| pnpm install --ignore-scripts | |
| rake build VERSION=1.0.0 | |
| # Verify build output (Vue builds to tools/testvuetool/ directory) | |
| test -f tools/testvuetool/main.js | |
| # Verify output is a SystemJS module | |
| grep -q "System.register" tools/testvuetool/main.js | |
| # Validate gem | |
| ../openc3.sh cli validate openc3-cosmos-tool-vue-test-1.0.0.gem | |
| cd .. | |
| # Test Angular tool generation and build | |
| - name: Generate and build Angular tool | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| # Generate plugin | |
| ./openc3.sh cli generate plugin tool-angular-test --ruby | |
| cd openc3-cosmos-tool-angular-test | |
| # Generate Angular tool | |
| ../openc3.sh cli generate tool_angular 'Test Angular Tool' --ruby | |
| # Verify tool structure created | |
| test -f package.json | |
| test -f angular.json | |
| test -f src/main.single-spa.ts | |
| # Verify tool was added to plugin.txt | |
| grep -q 'TOOL testangulartool "Test Angular Tool"' plugin.txt | |
| grep -q 'INLINE_URL main.js' plugin.txt | |
| # Verify package.json has required scripts | |
| grep -q '"build"' package.json | |
| # Build plugin (skip --frozen-lockfile for fresh plugins, keep --ignore-scripts) | |
| pnpm install --ignore-scripts | |
| rake build VERSION=1.0.0 | |
| # Verify build output (Angular builds to tools/testangulartool/) | |
| test -f tools/testangulartool/main.js | |
| # Verify output is a SystemJS module | |
| grep -q "System.register" tools/testangulartool/main.js | |
| # Validate gem | |
| ../openc3.sh cli validate openc3-cosmos-tool-angular-test-1.0.0.gem | |
| cd .. | |
| # Test React tool generation and build | |
| - name: Generate and build React tool | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| # Generate plugin | |
| ./openc3.sh cli generate plugin tool-react-test --ruby | |
| cd openc3-cosmos-tool-react-test | |
| # Generate React tool | |
| ../openc3.sh cli generate tool_react 'Test React Tool' --ruby | |
| # Verify tool structure created | |
| test -f package.json | |
| test -f webpack.config.js | |
| test -f src/root.component.js | |
| # Verify tool was added to plugin.txt | |
| grep -q 'TOOL testreacttool "Test React Tool"' plugin.txt | |
| grep -q 'INLINE_URL main.js' plugin.txt | |
| # Verify package.json has required scripts | |
| grep -q '"build"' package.json | |
| # Build plugin (skip --frozen-lockfile for fresh plugins, keep --ignore-scripts) | |
| pnpm install --ignore-scripts | |
| rake build VERSION=1.0.0 | |
| # Verify build output (React builds to tools/testreacttool/) | |
| test -f tools/testreacttool/main.js | |
| # Verify output is a SystemJS module | |
| grep -q "System.register" tools/testreacttool/main.js | |
| # Validate gem | |
| ../openc3.sh cli validate openc3-cosmos-tool-react-test-1.0.0.gem | |
| cd .. | |
| # Test Svelte tool generation and build | |
| - name: Generate and build Svelte tool | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| # Generate plugin | |
| ./openc3.sh cli generate plugin tool-svelte-test --ruby | |
| cd openc3-cosmos-tool-svelte-test | |
| # Generate Svelte tool | |
| ../openc3.sh cli generate tool_svelte 'Test Svelte Tool' --ruby | |
| # Verify tool structure created | |
| test -f package.json | |
| test -f rollup.config.js | |
| test -f src/App.svelte | |
| # Verify tool was added to plugin.txt | |
| grep -q 'TOOL testsveltetool "Test Svelte Tool"' plugin.txt | |
| grep -q 'INLINE_URL main.js' plugin.txt | |
| # Verify package.json has required scripts | |
| grep -q '"build"' package.json | |
| # Build plugin (skip --frozen-lockfile for fresh plugins, keep --ignore-scripts) | |
| pnpm install --ignore-scripts | |
| rake build VERSION=1.0.0 | |
| # Verify build output (Svelte builds to tools/testsveltetool/) | |
| test -f tools/testsveltetool/main.js | |
| # Verify output is a SystemJS module | |
| grep -q "System.register" tools/testsveltetool/main.js | |
| # Validate gem | |
| ../openc3.sh cli validate openc3-cosmos-tool-svelte-test-1.0.0.gem | |
| cd .. | |
| # Test widget generator | |
| - name: Generate and build widget | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| # Generate plugin | |
| ./openc3.sh cli generate plugin widget-test --ruby | |
| cd openc3-cosmos-widget-test | |
| # Generate widget | |
| ../openc3.sh cli generate widget TestWidget --ruby | |
| # Verify widget structure created in src/ directory | |
| test -f src/TestWidget.vue | |
| test -f package.json | |
| test -f vite.config.js | |
| # Verify widget was added to plugin.txt with correct format | |
| grep -q "WIDGET Test" plugin.txt | |
| # Verify package.json has required scripts | |
| grep -q '"build"' package.json | |
| # Build plugin (skip --frozen-lockfile for fresh plugins, keep --ignore-scripts) | |
| pnpm install --ignore-scripts | |
| rake build VERSION=1.0.0 | |
| # Verify build output (widgets build to tools/widgets/TestWidget/) | |
| test -f tools/widgets/TestWidget/TestWidget.umd.min.js | |
| # Validate gem | |
| ../openc3.sh cli validate openc3-cosmos-widget-test-1.0.0.gem | |
| cd .. | |
| # Test command_validator generator | |
| - name: Generate command validator | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| # Generate plugin | |
| ./openc3.sh cli generate plugin validator-test --ruby | |
| cd openc3-cosmos-validator-test | |
| # Generate target first (required for command_validator) | |
| ../openc3.sh cli generate target EXAMPLE --ruby | |
| # Generate command_validator | |
| ../openc3.sh cli generate command_validator EXAMPLE test --ruby | |
| # Verify command_validator file created | |
| ls targets/EXAMPLE/lib | grep test_command_validator.rb | |
| # Build plugin using documented workflow for non-tool plugins (README line 13) | |
| ../openc3.sh cli rake build VERSION=1.0.0 | |
| ../openc3.sh cli validate openc3-cosmos-validator-test-1.0.0.gem | |
| cd .. | |
| # Test generic tool command (should default to Vue) | |
| - name: Test generic tool command | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| # Generate plugin | |
| ./openc3.sh cli generate plugin tool-generic-test --ruby | |
| cd openc3-cosmos-tool-generic-test | |
| # Generate tool without specifying type (should default to Vue) | |
| ../openc3.sh cli generate tool 'Generic Tool' --ruby | |
| # Verify tool structure (should be Vue.js) | |
| test -f package.json | |
| test -f vite.config.js | |
| # Verify it's a Vue project by checking for Vue dependencies | |
| grep -q "vue" package.json | |
| # Build plugin (skip --frozen-lockfile for fresh plugins, keep --ignore-scripts) | |
| pnpm install --ignore-scripts | |
| rake build VERSION=1.0.0 | |
| # Verify build output (should be in tools/generictool/) | |
| test -f tools/generictool/main.js | |
| # Validate gem | |
| ../openc3.sh cli validate openc3-cosmos-tool-generic-test-1.0.0.gem | |
| cd .. | |
| - name: openc3.sh stop | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| ./openc3.sh stop | |
| sleep 20s | |
| ! docker ps | grep openc3 | |
| - name: Cleanup volumes | |
| shell: 'script -q -e -c "bash {0}"' | |
| run: | | |
| set -e | |
| docker volume ls | grep openc3 | |
| ./openc3.sh cleanup force | |
| ! docker volume ls | grep openc3 |