Merge pull request #235 from rararulab/issue-231-token-error #261
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
| name: CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| changes: | |
| name: Detect Changes | |
| runs-on: arc-runner-set | |
| outputs: | |
| code: ${{ steps.filter.outputs.code }} | |
| npm: ${{ steps.filter.outputs.npm }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Filter paths | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: filter | |
| with: | |
| filters: | | |
| code: | |
| - 'crates/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'rust-toolchain.toml' | |
| npm: | |
| - 'npm/**' | |
| lint: | |
| name: Lint | |
| needs: changes | |
| if: ${{ needs.changes.outputs.code == 'true' || github.event_name == 'push' }} | |
| uses: ./.github/workflows/lint.yml | |
| rust: | |
| name: Rust | |
| needs: changes | |
| if: ${{ needs.changes.outputs.code == 'true' || github.event_name == 'push' }} | |
| uses: ./.github/workflows/rust.yml | |
| npm-validate: | |
| name: Validate npm Package | |
| needs: changes | |
| if: ${{ needs.changes.outputs.npm == 'true' || github.event_name == 'push' }} | |
| runs-on: arc-runner-set | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| persist-credentials: false | |
| - name: Validate package structure | |
| run: | | |
| cd npm | |
| node --input-type=module -e " | |
| import { readFileSync } from 'node:fs'; | |
| const pkg = JSON.parse(readFileSync('package.json', 'utf8')); | |
| const checks = [ | |
| [pkg.bin, 'missing bin entry'], | |
| [pkg.optionalDependencies, 'missing optionalDependencies'], | |
| [Object.keys(pkg.optionalDependencies || {}).length === 4, 'expected 4 platform packages'], | |
| ]; | |
| for (const [ok, msg] of checks) { if (!ok) throw new Error(msg); } | |
| console.log('Package:', pkg.name, '| platforms:', Object.keys(pkg.optionalDependencies).join(', ')); | |
| " | |
| - name: Check npm pack (dry run) | |
| run: | | |
| cd npm | |
| npm pack --dry-run |