diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12da216..5a20eb8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,39 @@ on: - main jobs: - linux_test: + test_js: + name: Test Javascript code + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout + + - name: "Setup zig" + uses: korandoru/setup-zig@v1 + with: + zig-version: "master" + + - uses: actions/setup-node@v4 + name: Setup Node.js + with: + node-version: 20.x + + - name: Install dependencies + run: | + export DEBIAN_FRONTEND=noninteractive + sudo apt update + sudo apt install -y "binutils-multiarch" "build-essential" + npm install --no-save --ignore-scripts + + - name: Build addon + run: npm run dev + + - name: Run tests + env: + FORCE_COLOR: "true" + run: sudo node --no-warnings --loader ts-node/esm src/index_test.ts + + build_addon: runs-on: ubuntu-latest strategy: matrix: @@ -16,7 +48,6 @@ jobs: target_arch: [ "x86_64", "aarch64" ] target_os: - "linux" - # - "windows" # - "macos" steps: - uses: actions/checkout@v4 @@ -40,44 +71,11 @@ jobs: npm install --no-save --ignore-scripts - name: Build addon - run: npm run dev -- --target_zig=${{ matrix.target_arch }}-${{ matrix.target_os }} + run: npm run dev -- --target ${{ matrix.target_arch }}-${{ matrix.target_os }} - name: Upload prebuilds interface uses: actions/upload-artifact@v3 with: retention-days: 7 name: prebuilds_${{ matrix.target_arch }}-${{ matrix.target_os }}_${{ matrix.node_version }} - path: "prebuilds/**" - - - name: Test - run: node --require ts-node/register --loader ts-node/esm ./src/index_test.ts - - pack_package: - needs: linux_test - runs-on: ubuntu-latest - name: Pack npm package - env: - PACKAGE_VERSION: ${{ github.ref }} - steps: - - uses: actions/checkout@v4 - name: Code checkout - - - uses: actions/setup-node@v4 - name: Setup node.js - with: - node-version: 20.x - registry-url: https://registry.npmjs.org/ - - - name: Download all artefacts - uses: actions/download-artifact@v3 - with: - path: ./prebuilds - - - run: npm install --no-save --ignore-scripts - - run: npm pack - - - name: Upload npm package - uses: actions/upload-artifact@v3 - with: - name: Package_Pack - path: "*.tgz" + path: "build/*" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 30e1217..6ea6c93 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,16 +8,14 @@ test: export DEBIAN_FRONTEND=noninteractive sudo apt update wget -qO- https://deb.nodesource.com/setup_current.x | sudo bash - - packages=( "binutils-multiarch" "wget" "curl" "nodejs" ); - if [[ $(uname -m) == "x86_64" ]];then - packages+=( "gcc-*aarch64-linux-gnu" "gcc-*aarch64-linux-gnu-base" "g++-*aarch64-linux-gnu" "libc6-arm64-cross" ) - else - packages+=( "libc6-amd64-cross" "g++-*x86-64-linux-gnu" "g++-*x86-64-linux-gnux32" "gcc-*x86-64-linux-gnu" "gcc-*x86-64-linux-gnux32" ) - if [[ $(uname -m) != "aarch64" ]];then - packages+=( "gcc-*aarch64-linux-gnu" "gcc-*aarch64-linux-gnu-base" "g++-*aarch64-linux-gnu" "libc6-arm64-cross" ) - fi - fi + packages=( "binutils-multiarch" "wget" "curl" "nodejs" "build-essential" ); sudo apt install -y ${packages[@]} + + ZIGURL="https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz" + wget -qO- "${ZIGURL}" | sudo tar -xvJ -C /usr/local + sudo mv -v /usr/local/zig-linux /usr/local/zig + sudo ln -vs /usr/local/zig/bin/zig /usr/bin/zig + - npm install --no-save --ignore-scripts - - npm run prebuildify -- -v - - sudo node --require ts-node/register --loader ts-node/esm ./src/index_test.ts + - npm run dev + - sudo node --no-warnings --loader ts-node/esm ./src/index_test.ts diff --git a/package.json b/package.json index 604cf54..72cfd8b 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "scripts": { "install": "rebory prebuild", "dev": "rebory build -DP", + "test": "rebory build -D && node --no-warnings --loader ts-node/esm src/index_test.js", "prepack": "tsc --build --clean && tsc --build", "postpack": "tsc --build --clean" }, @@ -45,6 +46,6 @@ }, "dependencies": { "node-addon-api": "^7.1.0", - "rebory": "^0.1.10" + "rebory": "^0.1.11-2" } }