|
| 1 | +name: Differential Tests |
| 2 | +concurrency: |
| 3 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 4 | + cancel-in-progress: true |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + |
| 12 | +jobs: |
| 13 | + differential-tests: |
| 14 | + name: differential |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout pinned mfkdf2.rs commit |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + ref: 7c33c7164d6e40a26c0899f19b8f9ad9b9f0c029 |
| 21 | + |
| 22 | + - name: Install Rust |
| 23 | + uses: dtolnay/rust-toolchain@master |
| 24 | + with: |
| 25 | + toolchain: stable |
| 26 | + targets: wasm32-unknown-unknown |
| 27 | + |
| 28 | + - name: Rust Cache |
| 29 | + uses: Swatinem/rust-cache@v2 |
| 30 | + with: |
| 31 | + key: typescript/differential |
| 32 | + |
| 33 | + - name: Setup Node.js |
| 34 | + uses: actions/setup-node@v4 |
| 35 | + with: |
| 36 | + node-version: "20" |
| 37 | + cache: "npm" |
| 38 | + cache-dependency-path: mfkdf2-web/package-lock.json |
| 39 | + |
| 40 | + - name: Install wasm-bindgen-cli |
| 41 | + uses: taiki-e/install-action@v2 |
| 42 | + with: |
| 43 | + tool: wasm-bindgen-cli |
| 44 | + |
| 45 | + - name: Cache node_modules |
| 46 | + id: cache-node-modules |
| 47 | + uses: actions/cache@v4 |
| 48 | + with: |
| 49 | + path: mfkdf2-web/node_modules |
| 50 | + key: ${{ runner.os }}-node-modules-${{ hashFiles('mfkdf2-web/package-lock.json') }} |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-node-modules- |
| 53 | +
|
| 54 | + - name: Install mfkdf2-web dependencies |
| 55 | + if: steps.cache-node-modules.outputs.cache-hit != 'true' |
| 56 | + working-directory: mfkdf2-web |
| 57 | + run: npm ci |
| 58 | + |
| 59 | + - name: Generate TypeScript bindings for differential tests |
| 60 | + working-directory: mfkdf2-web |
| 61 | + run: npm run ubrn:web:differential:release |
| 62 | + |
| 63 | + - name: Copy index.web.ts implementation |
| 64 | + run: cp mfkdf2-web/src/index.ts mfkdf2-web/src/index.web.ts |
| 65 | + |
| 66 | + - name: Verify bindings were generated |
| 67 | + run: | |
| 68 | + if [ ! -d "mfkdf2-web/src/generated" ] || [ -z "$(ls -A mfkdf2-web/src/generated)" ]; then |
| 69 | + echo "Error: mfkdf2-web/src/generated does not exist or is empty" |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | + if [ ! -d "mfkdf2-web/rust_modules" ]; then |
| 73 | + echo "Error: mfkdf2-web/rust_modules does not exist" |
| 74 | + exit 1 |
| 75 | + fi |
| 76 | + echo "✓ TypeScript bindings verified" |
| 77 | +
|
| 78 | + - name: Run differential tests |
| 79 | + working-directory: mfkdf2-web |
| 80 | + run: npm run test:differential |
| 81 | + |
| 82 | + |
0 commit comments