|
| 1 | +name: Test Release Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - dev |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-matrix: |
| 11 | + name: Build matrix |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + build_matrix: ${{ steps.set-matrix.outputs.build_matrix }} |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 18 | + with: |
| 19 | + sparse-checkout: | |
| 20 | + .github/workflows/matrix.json |
| 21 | + sparse-checkout-cone-mode: false |
| 22 | + - id: set-matrix |
| 23 | + shell: bash |
| 24 | + run: | |
| 25 | + if [ "$ACT" == true ]; then |
| 26 | + echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output '[.[] | select(.RUN_LOCALLY)]' )" >> $GITHUB_OUTPUT |
| 27 | + else |
| 28 | + echo "build_matrix=$( cat .github/workflows/matrix.json | jq --monochrome-output --compact-output )" >> $GITHUB_OUTPUT |
| 29 | + fi |
| 30 | +
|
| 31 | + publish-npm-binaries: |
| 32 | + name: (Test) Publish npm binaries |
| 33 | + needs: build-matrix |
| 34 | + runs-on: ${{ matrix.build.OS }} |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + build: ${{ fromJson(needs.build-matrix.outputs.build_matrix) }} |
| 39 | + steps: |
| 40 | + - name: Debug workflow values |
| 41 | + shell: bash |
| 42 | + run: | |
| 43 | + echo "env.ACT : ${{ env.ACT }}" |
| 44 | + echo "matrix.build.NAME : ${{ matrix.build.NAME }}" |
| 45 | + echo "matrix.build.OS : ${{ matrix.build.OS }}" |
| 46 | + echo "matrix.build.RUN_LOCALLY : ${{ matrix.build.RUN_LOCALLY }}" |
| 47 | + echo "matrix.build.TARGET : ${{ matrix.build.TARGET }}" |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 50 | + - name: Install node |
| 51 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 52 | + with: |
| 53 | + node-version: 24 |
| 54 | + registry-url: "https://registry.npmjs.org" |
| 55 | + - name: Update npm |
| 56 | + run: npm install -g npm@latest |
| 57 | + - name: Install rust toolchain |
| 58 | + uses: dtolnay/rust-toolchain@stable |
| 59 | + with: |
| 60 | + targets: ${{ matrix.build.TARGET }} |
| 61 | + components: rustfmt, clippy |
| 62 | + - name: Add target to active toolchain |
| 63 | + shell: bash |
| 64 | + run: rustup target add ${{ matrix.build.TARGET }} |
| 65 | + - name: Set up cargo cache |
| 66 | + uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 |
| 67 | + - name: Install just |
| 68 | + uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0 |
| 69 | + with: |
| 70 | + just-version: 1.35.0 |
| 71 | + - name: Install cross |
| 72 | + if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-latest' }} |
| 73 | + uses: taiki-e/install-action@v2 |
| 74 | + with: |
| 75 | + tool: cross |
| 76 | + - name: Build rust binary (cross) |
| 77 | + if: ${{ !env.ACT && matrix.build.OS == 'ubuntu-latest' }} |
| 78 | + shell: bash |
| 79 | + run: cross build --release --locked --target ${{ matrix.build.TARGET }} |
| 80 | + - name: Build rust binary (cargo) |
| 81 | + if: ${{ env.ACT || matrix.build.OS != 'ubuntu-latest' }} |
| 82 | + shell: bash |
| 83 | + run: cargo build --release --locked --target ${{ matrix.build.TARGET }} |
| 84 | + - name: (Test) Publish rust binary package to npm |
| 85 | + shell: bash |
| 86 | + run: | |
| 87 | + just --dotenv-filename .env.${{ matrix.build.NAME }} create-npm-binary-package |
| 88 | +
|
| 89 | + publish-npm-base: |
| 90 | + name: (Test) Publish npm package |
| 91 | + needs: publish-npm-binaries |
| 92 | + runs-on: ubuntu-latest |
| 93 | + steps: |
| 94 | + - name: Checkout |
| 95 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 96 | + - name: Install node |
| 97 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 98 | + with: |
| 99 | + node-version: 24 |
| 100 | + registry-url: "https://registry.npmjs.org" |
| 101 | + - name: Update npm |
| 102 | + run: npm install -g npm@latest |
| 103 | + - name: Install just |
| 104 | + uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0 |
| 105 | + with: |
| 106 | + just-version: 1.35.0 |
| 107 | + - name: (Test) Publish the package |
| 108 | + shell: bash |
| 109 | + run: | |
| 110 | + npm install |
| 111 | + just --dotenv-filename .env.linux-x64-glibc create-npm-root-package |
0 commit comments