name: main on: push: branches: [master] pull_request: branches: [master] workflow_dispatch: env: CARGO_TERM_COLOR: always jobs: check-fmt: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "22.x" - run: npm ci - name: Check formatting run: npm run fmt -- --check - name: Check Rust formatting run: cargo fmt -- --check build: strategy: matrix: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} env: RUSTFLAGS: -D warnings steps: - uses: actions/checkout@v4 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: npm ci; - name: Prepare no-compat builds run: | ./builds/prepare_builds/prepare_all_projects.sh - name: Build all no-compat projects run: | ./builds/prepare_builds/build_all_projects.sh # Install dependencies to check simd for builds - name: Install wabt run: | sudo apt install wabt; if: matrix.os == 'ubuntu-latest' - name: Install wabt run: | brew install wabt; if: matrix.os == 'macos-latest' # Check simd for rust builds - name: Check 2d simd rust build run: | if ! wasm-objdump -d builds/rapier2d-simd/pkg/rapier_wasm2d_bg.wasm | grep :\\sfd ; then >&2 echo "ERROR: 2d simd compat build does not include simd opcode prefix." && exit 1 fi - name: Check 3d simd compat build run: | if ! wasm-objdump -d builds/rapier3d-simd/pkg/rapier_wasm3d_bg.wasm | grep :\\sfd ; then >&2 echo "ERROR: 3d simd compat build does not include simd opcode prefix." && exit 1 fi - uses: actions/upload-artifact@v4 with: name: pkg no-compat ${{ matrix.os }} path: | builds/*/pkg overwrite: true build-compat: strategy: matrix: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} env: RUSTFLAGS: -D warnings steps: - uses: actions/checkout@v4 - uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - run: npm ci; - name: Prepare compat builds run: | ./builds/prepare_builds/prepare_all_projects.sh - name: Build rapier-compat run: | cd rapier-compat; npm ci; npm run build; npm run test; # Install dependencies to check simd for builds - name: Install wabt run: | sudo apt install wabt; if: matrix.os == 'ubuntu-latest' - name: Install wabt run: | brew install wabt; if: matrix.os == 'macos-latest' # Check simd for compat builds - name: Check 2d simd compat build run: | if ! wasm-objdump -d rapier-compat/builds/2d-simd/pkg/rapier_wasm2d_bg.wasm | grep :\\sfd ; then >&2 echo "ERROR: 2d simd compat build does not include simd opcode prefix." && exit 1; fi - name: Check 3d simd compat build run: | if ! wasm-objdump -d rapier-compat/builds/3d-simd/pkg/rapier_wasm3d_bg.wasm | grep :\\sfd ; then >&2 echo "ERROR: 3d simd compat build does not include simd opcode prefix." && exit 1; fi # Upload - uses: actions/upload-artifact@v4 with: name: pkg compat ${{ matrix.os }} path: | rapier-compat/builds/*/pkg overwrite: true publish: runs-on: ubuntu-latest needs: [build, build-compat] if: github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: name: pkg no-compat ubuntu-latest path: builds - uses: actions/download-artifact@v4 with: name: pkg compat ubuntu-latest path: rapier-compat/builds - uses: actions/setup-node@v4 with: node-version: "22.x" registry-url: "https://registry.npmjs.org" - name: Publish projects run: | ./publish_all_canary.sh env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}