-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into matttyson-master
- Loading branch information
Showing
44 changed files
with
2,256 additions
and
691 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
name: release | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: windows-latest | ||
arch: x64 | ||
node: 16 | ||
- os: windows-latest | ||
arch: arm64 | ||
node: 20 | ||
- os: windows-latest | ||
arch: ia32 | ||
node: 16 | ||
- os: macos-latest | ||
arch: x64 | ||
node: 16 | ||
- os: macos-latest | ||
arch: arm64 | ||
node: 16 | ||
- os: ubuntu-latest | ||
arch: x64 | ||
libc: glibc | ||
image: ghcr.io/prebuild/centos7-devtoolset7:2.1.1 | ||
node: 16 | ||
- os: ubuntu-latest | ||
arch: x64 | ||
libc: musl | ||
image: ghcr.io/prebuild/alpine:2.1.1 | ||
node: 16 | ||
- os: ubuntu-latest | ||
arch: arm64 | ||
libc: glibc | ||
image: ghcr.io/prebuild/linux-arm64-lts:2.1.1 | ||
node: 16 | ||
- os: ubuntu-latest | ||
arch: arm64 | ||
libc: musl | ||
image: ghcr.io/prebuild/linux-arm64-musl:2.1.1 | ||
node: 16 | ||
- os: ubuntu-latest | ||
arch: arm | ||
libc: glibc | ||
image: ghcr.io/prebuild/linux-armv7:2.1.1 | ||
node: 16 | ||
- os: ubuntu-latest | ||
arch: arm64 | ||
image: ghcr.io/prebuild/android-arm64:2.1.1 | ||
node: 16 | ||
runs-on: ${{matrix.os}} | ||
container: | ||
image: ${{matrix.image}} | ||
options: -u root | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: yarn | ||
node-version: ${{matrix.node}} | ||
- run: yarn --frozen-lockfile --ignore-scripts | ||
- run: npm install node-gyp -g | ||
- run: yarn prebuild --arch ${{ matrix.arch }} -t ${{ matrix.node }}.0.0 | ||
env: | ||
PREBUILD_LIBC: ${{ matrix.libc }} | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: prebuilds | ||
path: prebuilds | ||
|
||
build-freebsd: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build FreeBSD | ||
uses: vmactions/freebsd-vm@v1 | ||
with: | ||
usesh: true | ||
prepare: | | ||
pkg install -y -f curl node libnghttp2 npm yarn | ||
echo "~~~~ node -v ~~~~" | ||
node -v | ||
echo "~~~~ yarn --version ~~~~" | ||
yarn --version | ||
run: | | ||
yarn --frozen-lockfile --ignore-scripts | ||
npm install node-gyp -g | ||
yarn prebuild --arch x64 -t 16.0.0 | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: prebuilds | ||
path: prebuilds | ||
|
||
build-wasm: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: emscripten/emsdk | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: yarn | ||
node-version: 18 | ||
- run: yarn --frozen-lockfile | ||
- run: make wasm | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: wasm | ||
path: build/Release/watcher.wasm | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- build-freebsd | ||
- build-wasm | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: yarn | ||
node-version: 16 | ||
- run: yarn --frozen-lockfile --ignore-scripts | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
- name: Build npm packages | ||
run: | | ||
node scripts/build-npm.js | ||
node scripts/build-wasm.js | ||
- name: Publish to npm | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: | | ||
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > ~/.npmrc | ||
for pkg in npm/*; do | ||
echo "Publishing $pkg..." | ||
cd $pkg; | ||
npm publish; | ||
cd ../..; | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: test | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node: [18, 20] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: yarn | ||
node-version: ${{matrix.node}} | ||
- name: Install watchman | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
run: | | ||
wget https://github.com/facebook/watchman/releases/download/v2023.05.01.00/watchman-v2023.05.01.00-macos.zip | ||
unzip watchman-*-macos.zip | ||
cd watchman-v2023.05.01.00-macos | ||
sudo mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman | ||
sudo cp bin/* /usr/local/bin | ||
sudo cp lib/* /usr/local/lib | ||
sudo chmod 755 /usr/local/bin/watchman | ||
sudo chmod 2777 /usr/local/var/run/watchman | ||
watchman -v | ||
- name: Install watchman | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
wget https://github.com/facebook/watchman/releases/download/v2023.06.19.00/watchman-v2023.06.19.00-linux.zip | ||
unzip watchman-*-linux.zip | ||
cd watchman-v2023.06.19.00-linux | ||
sudo mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman | ||
sudo cp bin/* /usr/local/bin | ||
sudo cp lib/* /usr/local/lib | ||
sudo chmod 755 /usr/local/bin/watchman | ||
sudo chmod 2777 /usr/local/var/run/watchman | ||
- name: Copy watchman | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
run: | | ||
Copy-Item -Recurse -Path watchman -Destination $home | ||
$env:PATH += ";$home\watchman\windows\bin" | ||
Add-Content $env:GITHUB_PATH "$home\watchman\windows\bin" | ||
watchman -v | ||
- run: yarn --frozen-lockfile | ||
- run: yarn test | ||
|
||
test-freebsd: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Test in FreeBSD | ||
uses: vmactions/freebsd-vm@v1 | ||
with: | ||
usesh: true | ||
prepare: | | ||
pkg install -y -f curl node libnghttp2 npm yarn | ||
echo "~~~~ node -v ~~~~" | ||
node -v | ||
echo "~~~~ yarn --version ~~~~" | ||
yarn --version | ||
run: | | ||
yarn --frozen-lockfile | ||
yarn test | ||
test-wasm: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: emscripten/emsdk | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: yarn | ||
node-version: 18 | ||
- run: yarn --frozen-lockfile | ||
- run: make wasm-debug | ||
- run: TEST_WASM=1 yarn test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ token.txt | |
stress-test | ||
crash.log | ||
test/snapshot.txt | ||
npm |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
.PHONY: docker-build-centos docker-build-alpine docker-push-centos | ||
NODE_PATH := $(dir $(shell which node)) | ||
HEADERS_URL := $(shell node -p "process.release.headersUrl") | ||
NODE_VERSION := $(shell node -p "process.version") | ||
|
||
current_dir = $(shell pwd) | ||
GIT_SHA = $(shell git log -1 --pretty=%h) | ||
INCS_Debug := \ | ||
-Ibuild/node-$(NODE_VERSION)/include/node \ | ||
-I$(shell node -p "require('node-addon-api').include_dir") | ||
|
||
git_sha: | ||
echo GIT_SHA is $(GIT_SHA) | ||
SRC := src/binding.cc src/Watcher.cc src/Backend.cc src/DirTree.cc src/Glob.cc src/Debounce.cc src/shared/BruteForceBackend.cc src/unix/legacy.cc src/wasm/WasmBackend.cc | ||
FLAGS := $(INCS_Debug) \ | ||
-Oz \ | ||
-flto \ | ||
-fwasm-exceptions \ | ||
-DNAPI_HAS_THREADS=1 \ | ||
-sEXPORTED_FUNCTIONS="['_napi_register_wasm_v1', '_wasm_backend_event_handler', '_malloc', '_free', '_on_timeout']" \ | ||
-sERROR_ON_UNDEFINED_SYMBOLS=0 \ | ||
-s INITIAL_MEMORY=524288000 | ||
|
||
docker-build-centos: | ||
docker build -t jasperdm/centos-watchman:latest -t jasperdm/centos-watchman:$(GIT_SHA) -f ./docker-agents/centos.Dockerfile . --progress plain | ||
build/node-headers.tar.gz: | ||
curl $(HEADERS_URL) -o build/node-headers.tar.gz | ||
|
||
docker-build-alpine: | ||
docker build -t jasperdm/alpine-watchman:latest -t jasperdm/alpine-watchman:$(GIT_SHA) -f ./docker-agents/alpine.Dockerfile . --progress plain | ||
build/node-$(NODE_VERSION): build/node-headers.tar.gz | ||
tar -xvf build/node-headers.tar.gz -C build | ||
touch build/node-$(NODE_VERSION) | ||
|
||
docker-push-centos: | ||
docker push jasperdm/centos-watchman:${GIT_SHA} | ||
docker push jasperdm/centos-watchman:latest | ||
build/Release/watcher.wasm: build/node-$(NODE_VERSION) $(SRC) | ||
mkdir -p build/Release | ||
em++ $(FLAGS) -sDECLARE_ASM_MODULE_EXPORTS=0 -o build/Release/watcher.js $(SRC) | ||
|
||
docker-push-alpine: | ||
docker push jasperdm/alpine-watchman:${GIT_SHA} | ||
docker push jasperdm/alpine-watchman:latest | ||
build/Debug/watcher.wasm: build/node-$(NODE_VERSION) $(SRC) | ||
mkdir -p build/Debug | ||
em++ -g $(FLAGS) -o build/Debug/watcher.js $(SRC) | ||
|
||
wasm: build/Release/watcher.wasm | ||
wasm-debug: build/Debug/watcher.wasm | ||
|
||
.PHONY: wasm wasm-debug |
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
Oops, something went wrong.