From 93e712d01a7719bea44937ed63cdc1e4d6f502dc Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Mon, 7 Oct 2024 10:20:50 +0200 Subject: [PATCH] Refactor CI pipeline --- .github/workflows/CI.yml | 41 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8200a39..ba856b7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,19 +25,21 @@ jobs: strategy: fail-fast: false matrix: - targets: - [ - 'x86_64-apple-darwin', - 'aarch64-apple-darwin', - 'x86_64-unknown-linux-gnu', - 'aarch64-unknown-linux-gnu', - 'x86_64-unknown-linux-musl', - 'aarch64-unknown-linux-musl', - 'x86_64-pc-windows-msvc', - 'aarch64-pc-windows-msvc', - ] - runs-on: ubuntu-latest - name: Build - ${{ matrix.targets }} - node@20 + settings: + - target: x86_64-apple-darwin + build: yarn build --target x86_64-apple-darwin + - target: aarch64-apple-darwin + build: yarn build --target aarch64-apple-darwin + - target: x86_64-unknown-linux-gnu + build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross + - target: aarch64-unknown-linux-gnu + build: yarn build --target aarch64-unknown-linux-gnu --use-napi-cross + - target: x86_64-pc-windows-msvc + build: yarn build --target x86_64-pc-windows-msvc + - target: aarch64-pc-windows-msvc + build: yarn build --target aarch64-pc-windows-msvc + runs-on: ubuntu-latest + name: Build - ${{ matrix.settings.target }} - node@20 steps: - uses: actions/checkout@v4 - name: Cache cargo registry @@ -48,19 +50,16 @@ jobs: ${{ github.workspace }}/.xwin ~/.napi-rs ./target - key: ${{ matrix.targets }}-cargo-cache + key: ${{ matrix.settings.target }}-cargo-cache - name: Install uses: dtolnay/rust-toolchain@stable with: toolchain: stable - targets: ${{ matrix.targets }} + targets: ${{ matrix.settings.target }} - uses: actions/setup-node@v4 with: node-version: '20' cache: 'yarn' - - name: Install multilib package - run: sudo apt install gcc-multilib - shell: bash - name: Install ziglang uses: mlugg/setup-zig@v1 with: @@ -70,15 +69,15 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} with: - tool: cargo-zigbuild,cargo-xwin + tool: cargo-zigbuild,cargo-xwin - run: yarn install - - run: yarn build --target ${{ matrix.targets }} + - run: ${{ matrix.settings.build }} env: XWIN_CACHE_DIR: ${{ github.workspace }}/.xwin - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: bindings-${{ matrix.targets }} + name: bindings-${{ matrix.settings.target }} path: ${{ env.APP_NAME }}.*.node if-no-files-found: error