Skip to content

Commit

Permalink
ci: update
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Jul 9, 2024
1 parent 86651fa commit c4e3c1a
Showing 1 changed file with 21 additions and 72 deletions.
93 changes: 21 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ env:
DEBUG: napi:*
APP_NAME: react-server-action
MACOSX_DEPLOYMENT_TARGET: '10.13'
CC: clang
CARGO_INCREMENTAL: '1'
permissions:
contents: write
id-token: write
Expand Down Expand Up @@ -97,7 +99,7 @@ jobs:
- uses: goto-bus-stop/setup-zig@v2
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.12.0
version: 0.13.0
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
Expand All @@ -116,65 +118,11 @@ jobs:
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
if: matrix.settings.target != 'wasm32-wasip1-threads'
with:
name: bindings-${{ matrix.settings.target }}
path: "*.node"
if-no-files-found: error

- name: Upload artifact
uses: actions/upload-artifact@v4
if: matrix.settings.target == 'wasm32-wasip1-threads'
with:
name: bindings-${{ matrix.settings.target }}
path: "*.wasm"
if-no-files-found: error
build-freebsd:
runs-on: macos-13
name: Build FreeBSD
steps:
- uses: actions/checkout@v4
- name: Build
id: build
uses: cross-platform-actions/[email protected]
env:
DEBUG: napi:*
RUSTUP_IO_THREADS: 1
with:
operating_system: freebsd
version: '13.2'
memory: 8G
cpu_count: 3
environment_variables: 'DEBUG RUSTUP_IO_THREADS'
shell: bash
run: |
sudo pkg install -y -f curl node libnghttp2 npm
sudo npm install -g corepack
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain beta
corepack prepare
corepack enable
source "$HOME/.cargo/env"
echo "~~~~ rustc --version ~~~~"
rustc --version
echo "~~~~ node -v ~~~~"
node -v
echo "~~~~ pnpm --version ~~~~"
pnpm --version
pwd
ls -lah
whoami
env
freebsd-version
pnpm install
pnpm build
rm -rf node_modules
rm -rf target
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-freebsd
path: ${{ env.APP_NAME }}.*.node
path: |
./*.node
./*.wasm
if-no-files-found: error
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
Expand Down Expand Up @@ -213,7 +161,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: .
path: ./packages/core
- name: List packages
run: ls -R .
shell: bash
Expand Down Expand Up @@ -272,7 +220,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: bindings-${{ matrix.target }}
path: .
path: ./packages/core
- name: List packages
run: ls -R .
shell: bash
Expand All @@ -286,9 +234,10 @@ jobs:
with:
image: ${{ steps.docker.outputs.IMAGE }}
options: -v ${{ steps.docker.outputs.PNPM_STORE_PATH }}:${{ steps.docker.outputs.PNPM_STORE_PATH }} -v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}
run: npm run test
run: corepack enable && npm run test
# test-wasi:
# name: Test WASI target
# if: false
# needs:
# - build
# runs-on: ubuntu-latest
Expand All @@ -307,7 +256,7 @@ jobs:
# uses: actions/download-artifact@v4
# with:
# name: bindings-wasm32-wasip1-threads
# path: .
# path: ./packages/core
# - name: List packages
# run: ls -R .
# shell: bash
Expand All @@ -319,10 +268,9 @@ jobs:
name: Publish
runs-on: ubuntu-latest
needs:
- build-freebsd
- test-macOS-windows-binding
- test-linux-binding
# - test-wasi
# - test-wasi
steps:
- uses: actions/checkout@v4
- name: setup pnpm
Expand All @@ -339,26 +287,27 @@ jobs:
with:
path: artifacts
- name: create npm dirs
run: pnpm napi create-npm-dirs
- name: Move artifacts
run: pnpm artifacts
run: |
pnpm napi create-npm-dirs
pnpm napi artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm config set provenance true
if git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
pnpm napi pre-publish -t npm
pnpm publish --access public
elif git log -1 --pretty=%B | grep "^v\?[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
pnpm napi pre-publish -t npm
pnpm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit c4e3c1a

Please sign in to comment.