CI #43
Workflow file for this run
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] | |
| tags: | |
| - "v*" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| check: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Cargo check | |
| run: cargo check --all-features --verbose --manifest-path js/wasm/Cargo.toml | |
| clippy: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: clippy | |
| - name: Cargo clippy | |
| run: cargo clippy --all-features --verbose --manifest-path js/wasm/Cargo.toml | |
| test_oca-js_wasm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Install wasm-bindgen-cli | |
| run: cargo install -f wasm-bindgen-cli --version 0.2.110 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| - name: Setup yarn | |
| run: npm install -g yarn | |
| - name: Build wasm | |
| working-directory: js/wasm | |
| run: bash build-pkg.sh | |
| - name: Install dependencies | |
| working-directory: js/example | |
| run: yarn install --network-concurrency 1 | |
| - name: Run tests | |
| working-directory: js/example | |
| run: yarn test | |
| publish_oca-js_wasm: | |
| runs-on: ubuntu-latest | |
| if: github.ref_type == 'tag' | |
| needs: | |
| - test_oca-js_wasm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Install wasm-bindgen-cli | |
| run: cargo install wasm-bindgen-cli --version 0.2.92 | |
| - name: Build wasm | |
| working-directory: js/wasm | |
| run: bash build-pkg.sh | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| # (Optional but safe) ensure npm is new enough even if Node changes | |
| - name: Upgrade npm | |
| run: npm i -g npm@^11.5.1 | |
| - name: Ensure token auth is not used (OIDC only) | |
| run: | | |
| unset NODE_AUTH_TOKEN | |
| unset NPM_TOKEN | |
| rm -f ~/.npmrc | |
| rm -f .npmrc | |
| - name: Debug npm auth inputs | |
| run: | | |
| echo "NODE_AUTH_TOKEN set? " $([ -n "${NODE_AUTH_TOKEN}" ] && echo yes || echo no) | |
| echo "NPM_TOKEN set? " $([ -n "${NPM_TOKEN}" ] && echo yes || echo no) | |
| npm config list -l | sed -n '1,120p' | |
| - name: Install dependencies | |
| working-directory: js/wasm/pkg | |
| run: npm install --omit=dev | |
| - name: Publish to npm (OIDC) | |
| working-directory: js/wasm/pkg | |
| env: | |
| NODE_AUTH_TOKEN: "" # override/clear | |
| run: | | |
| unset NODE_AUTH_TOKEN | |
| npm publish --provenance |