Skip to content

Commit 9a38e9e

Browse files
committed
fix(github): fix release pipeline
1 parent f99d54f commit 9a38e9e

8 files changed

Lines changed: 137 additions & 20 deletions

File tree

.env.linux-arm64-glibc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ NAME=linux-arm64-glibc
22
NODE_ARCH=arm64
33
NODE_OS=linux
44
NODE_PKG_NAME=syncpack-linux-arm64
5-
OS=ubuntu-22.04
5+
OS=ubuntu-latest
66
TARGET=aarch64-unknown-linux-gnu
77
RUST_BINARY_PATH="target/${TARGET}/release/syncpack"
88
NODE_PKG_DIR_PATH="npm/packages/${NODE_PKG_NAME}"

.env.linux-arm64-musl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ NAME=linux-arm64-musl
22
NODE_ARCH=arm64
33
NODE_OS=linux
44
NODE_PKG_NAME=syncpack-linux-arm64-musl
5-
OS=ubuntu-22.04
5+
OS=ubuntu-latest
66
TARGET=aarch64-unknown-linux-musl
77
RUST_BINARY_PATH="target/${TARGET}/release/syncpack"
88
NODE_PKG_DIR_PATH="npm/packages/${NODE_PKG_NAME}"

.env.linux-x64-glibc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ NAME=linux-x64-glibc
22
NODE_ARCH=x64
33
NODE_OS=linux
44
NODE_PKG_NAME=syncpack-linux-x64
5-
OS=ubuntu-22.04
5+
OS=ubuntu-latest
66
TARGET=x86_64-unknown-linux-gnu
77
RUST_BINARY_PATH="target/${TARGET}/release/syncpack"
88
NODE_PKG_DIR_PATH="npm/packages/${NODE_PKG_NAME}"

.env.linux-x64-musl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ NAME=linux-x64-musl
22
NODE_ARCH=x64
33
NODE_OS=linux
44
NODE_PKG_NAME=syncpack-linux-x64-musl
5-
OS=ubuntu-22.04
5+
OS=ubuntu-latest
66
TARGET=x86_64-unknown-linux-musl
77
RUST_BINARY_PATH="target/${TARGET}/release/syncpack"
88
NODE_PKG_DIR_PATH="npm/packages/${NODE_PKG_NAME}"

.github/workflows/benchmark.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
jobs:
1212
benchmark:
1313
name: Benchmark
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/matrix.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
[
22
{
33
"NAME": "linux-x64-glibc",
4-
"OS": "ubuntu-22.04",
4+
"OS": "ubuntu-latest",
55
"RUN_LOCALLY": true,
66
"TARGET": "x86_64-unknown-linux-gnu"
77
},
88
{
99
"NAME": "linux-x64-musl",
10-
"OS": "ubuntu-22.04",
10+
"OS": "ubuntu-latest",
1111
"RUN_LOCALLY": false,
1212
"TARGET": "x86_64-unknown-linux-musl"
1313
},
1414
{
1515
"NAME": "linux-arm64-glibc",
16-
"OS": "ubuntu-22.04",
16+
"OS": "ubuntu-latest",
1717
"RUN_LOCALLY": false,
1818
"TARGET": "aarch64-unknown-linux-gnu"
1919
},
2020
{
2121
"NAME": "linux-arm64-musl",
22-
"OS": "ubuntu-22.04",
22+
"OS": "ubuntu-latest",
2323
"RUN_LOCALLY": false,
2424
"TARGET": "aarch64-unknown-linux-musl"
2525
},

.github/workflows/release.yaml

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

0 commit comments

Comments
 (0)