fixup! chore(release): publish 0.0.77; rm DoH #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build rsapi | |
env: | |
DEBUG: 'napi:*' | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
NODE_OPTIONS: '--max-old-space-size=3072' | |
CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST: true | |
CARGO_TARGET_APPLIES_TO_HOST: false | |
on: | |
push: | |
branches: | |
- master | |
# tags-ignore: | |
# - '**' | |
# paths: | |
# - 'packages/rsapi' | |
# - 'sync' | |
pull_request: | |
# paths: | |
# - 'packages/rsapi' | |
# - 'sync' | |
jobs: | |
build-freebsd: | |
runs-on: macos-12 | |
name: Build FreeBSD | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
id: build | |
uses: vmactions/freebsd-vm@v0 | |
env: | |
DEBUG: 'napi:*' | |
RUSTUP_HOME: /usr/local/rustup | |
CARGO_HOME: /usr/local/cargo | |
RUSTUP_IO_THREADS: 1 | |
with: | |
envs: 'DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS' | |
usesh: true | |
mem: 3000 | |
prepare: | | |
pkg install -y -f curl node libnghttp2 | |
curl -qL https://www.npmjs.com/install.sh | sh | |
npm install --location=global --ignore-scripts yarn | |
curl https://sh.rustup.rs -sSf --output rustup.sh | |
sh rustup.sh -y --profile minimal --default-toolchain stable | |
export PATH="/usr/local/cargo/bin:$PATH" | |
echo "~~~~ rustc --version ~~~~" | |
rustc --version | |
echo "~~~~ node -v ~~~~" | |
node -v | |
echo "~~~~ yarn --version ~~~~" | |
yarn --version | |
run: | | |
export PATH="/usr/local/cargo/bin:$PATH" | |
pwd | |
ls -lah | |
whoami | |
env | |
freebsd-version | |
yarn install --immutable --mode=skip-build | |
yarn build | |
strip -x packages/*/*.node | |
rm -rf node_modules | |
rm -rf target | |
rm -rf .yarn/cache | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bindings-freebsd-amd64 | |
path: packages/*/*.node | |
if-no-files-found: error | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-12 | |
architecture: x64 | |
target: 'x86_64-apple-darwin' | |
build: | | |
yarn build | |
strip -x packages/*/*.node | |
- host: windows-latest | |
architecture: x64 | |
build: yarn build | |
target: 'x86_64-pc-windows-msvc' | |
# Blocked by https://github.com/briansmith/ring/pull/1554 | |
#- host: windows-latest | |
# architecture: x64 | |
# build: | | |
# yarn lerna exec "yarn build --target aarch64-pc-windows-msvc" --concurrency 1 --stream --no-prefix | |
# target: 'aarch64-pc-windows-msvc' | |
- host: ubuntu-20.04 | |
architecture: x64 | |
target: 'x86_64-unknown-linux-gnu' | |
build: >- | |
set -e && | |
yarn build && | |
strip -x packages/*/*.node | |
#- host: ubuntu-latest | |
# architecture: x64 | |
# target: 'x86_64-unknown-linux-musl' | |
# docker: | | |
# docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
# docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine builder | |
# build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build | |
- host: macos-latest | |
architecture: x64 | |
target: 'aarch64-apple-darwin' | |
build: | | |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*; | |
export CC=$(xcrun -f clang); | |
export CXX=$(xcrun -f clang++); | |
SYSROOT=$(xcrun --sdk macosx --show-sdk-path); | |
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; | |
npx lerna exec "yarn build --target aarch64-apple-darwin" --concurrency 1 --stream --no-prefix | |
strip -x packages/*/*.node | |
- host: ubuntu-20.04 | |
architecture: x64 | |
target: 'aarch64-unknown-linux-gnu' | |
setup: | | |
sudo apt-get update | |
sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y | |
build: | | |
rustup toolchain install $(cat ./rust-toolchain) | |
rustup target add aarch64-unknown-linux-gnu | |
yarn lerna exec "yarn build --target aarch64-unknown-linux-gnu" --concurrency 1 --stream --no-prefix | |
aarch64-linux-gnu-strip packages/*/*.node | |
name: stable - ${{ matrix.settings.target }} - node@18 | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
node-version: 18 | |
check-latest: true | |
cache: yarn | |
architecture: ${{ matrix.settings.architecture }} | |
- name: Install | |
uses: actions-rs/toolchain@v1 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
toolchain: nightly | |
profile: minimal | |
override: true | |
target: ${{ matrix.settings.target }} | |
- name: Generate Cargo.lock | |
uses: actions-rs/cargo@v1 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
command: generate-lockfile | |
- name: Cache cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ matrix.settings.target }}-node@18-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/git | |
key: ${{ matrix.settings.target }}-node@18-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache NPM dependencies | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: npm-cache-${{ matrix.settings.target }}-node@18-${{ hashFiles('yarn.lock') }} | |
- name: Setup toolchain | |
run: ${{ matrix.settings.setup }} | |
if: ${{ matrix.settings.setup }} | |
shell: bash | |
- name: 'Install dependencies' | |
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 | |
- name: Build in docker | |
uses: addnab/docker-run-action@v3 | |
if: ${{ matrix.settings.docker }} | |
with: | |
image: ${{ matrix.settings.docker }} | |
options: -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build | |
run: ${{ matrix.settings.build }} | |
- name: 'Or Build without docker' | |
run: ${{ matrix.settings.build }} | |
if: ${{ !matrix.settings.docker }} | |
shell: bash | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: packages/*/*.node | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- build-freebsd | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
check-latest: true | |
cache: yarn | |
- name: Cache NPM dependencies | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: npm-cache-ubuntu-latest-publish-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
run: yarn install --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts | |
- name: List artifacts | |
run: ls -R artifacts | |
shell: bash | |
- name: Move artifacts | |
run: yarn artifacts | |
- name: List artifacts | |
run: ls -R artifacts | |
shell: bash | |
- name: Move artifacts manually | |
# mv artifacts/bindings-aarch64-pc-windows-msvc/rsapi/rsapi.win32-arm64-msvc.node packages/rsapi/npm/win32-arm64-msvc/ | |
run: | | |
mv artifacts/bindings-x86_64-unknown-linux-gnu/rsapi/rsapi.linux-x64-gnu.node packages/rsapi/npm/linux-x64-gnu/ | |
mv artifacts/bindings-x86_64-pc-windows-msvc/rsapi/rsapi.win32-x64-msvc.node packages/rsapi/npm/win32-x64-msvc/ | |
mv artifacts/bindings-x86_64-apple-darwin/rsapi/rsapi.darwin-x64.node packages/rsapi/npm/darwin-x64/ | |
mv artifacts/bindings-aarch64-apple-darwin/rsapi/rsapi.darwin-arm64.node packages/rsapi/npm/darwin-arm64/ | |
mv artifacts/bindings-aarch64-unknown-linux-gnu/rsapi/rsapi.linux-arm64-gnu.node packages/rsapi/npm/linux-arm64-gnu/ | |
mv artifacts/bindings-freebsd-amd64/rsapi/rsapi.freebsd-x64.node packages/rsapi/npm/freebsd-x64/ | |
- name: List packages | |
run: ls -R packages | |
shell: bash | |
- name: Lerna publish | |
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')" | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | |
npx lerna publish from-package --no-verify-access --yes | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |