Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node release workflow #2 (alternative) #459

Merged
merged 38 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
acde282
arm64 brew dependencies
mnutt May 14, 2022
911ccb5
update package
acalcutt Sep 9, 2022
b0b20cf
change releases
acalcutt Sep 9, 2022
f18a75a
Create node-release.yml
acalcutt Sep 9, 2022
b49123c
move publish steps to node-release.yml
acalcutt Sep 9, 2022
bc29283
merge in changes from https://github.com/maplibre/maplibre-gl-native/…
acalcutt Sep 9, 2022
7e8a27c
Merge remote-tracking branch 'upstream/main' into node-release2
acalcutt Sep 9, 2022
748d4a8
Update node-release.yml
acalcutt Sep 9, 2022
e60d33f
switch to node-pre-gyp fork that supports node 18
mnutt May 17, 2022
75ef231
Delete yarn.lock
acalcutt Sep 9, 2022
1484416
add change from macos build
acalcutt Sep 9, 2022
db66f98
change publish to x86_64 only so it only happens once
acalcutt Sep 9, 2022
07cf509
make a release instead of a draft
acalcutt Sep 9, 2022
3be8c54
continue-on-error: true
acalcutt Sep 9, 2022
59917bc
add back tests
acalcutt Sep 9, 2022
40443b8
Update matrix, labeling, merge in forced arm
acalcutt Sep 10, 2022
56d32b7
set npm version
acalcutt Sep 10, 2022
a44e567
Get ci in sync with release
acalcutt Sep 10, 2022
56c0c0d
maplibre-ify
acalcutt Sep 10, 2022
e407443
Merge remote-tracking branch 'upstream/main' into node-release2
acalcutt Sep 10, 2022
f6038e5
Update package-lock.json
acalcutt Sep 10, 2022
cbbc7f0
add node 10
acalcutt Sep 10, 2022
5813a75
rename job
acalcutt Sep 11, 2022
b91bb6f
try changing node-pre-gyp back to 1.0.10
acalcutt Sep 11, 2022
321abf2
try to make universal build
acalcutt Sep 11, 2022
b5f5d8c
add quotes
acalcutt Sep 11, 2022
878962d
Merge remote-tracking branch 'upstream/main' into node-release2
acalcutt Sep 13, 2022
f4994df
revert trying to make universal package
acalcutt Sep 13, 2022
5c5ea43
remove sed replacement
acalcutt Sep 13, 2022
9b8fa81
Delete brew-install-arm64.sh
acalcutt Sep 13, 2022
59905a8
Revert "try changing node-pre-gyp back to 1.0.10"
acalcutt Sep 13, 2022
06a3ac1
use @acalcutt/node-pre-gyp for node 18 --target
acalcutt Sep 14, 2022
2f07c61
macos-12-arm, sync test and release
acalcutt Sep 23, 2022
8d98443
put back brew commands
acalcutt Sep 23, 2022
a27c768
Merge remote-tracking branch 'upstream/main' into node-release2
acalcutt Sep 23, 2022
864af29
Revert "add node 10"
acalcutt Sep 23, 2022
a6fb7b8
Change Info label to Architecture
acalcutt Sep 23, 2022
7705662
see if test works on arm
acalcutt Sep 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ concurrency:

jobs:
test:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
os:
- macos-12
- ubuntu-20.04
node: [ 14, 16, 18 ]
name: OS ${{ matrix.os }} Node ${{ matrix.node }}
runs-on: ${{ matrix.os }}
include:
- runs-on: ubuntu-20.04
arch: x86_64
- runs-on: macos-12
arch: x86_64
- runs-on: macos-12-arm
arch: arm64
continue-on-error: true
env:
BUILDTYPE: ${{github.ref == 'refs/heads/main' && 'Release' || 'Debug'}}
Expand All @@ -96,7 +99,15 @@ jobs:
submodules: recursive
fetch-depth: 0

- name: Install dependencies
- name: Get OS Architecture
run: uname -m

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies macOS
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
Expand All @@ -109,7 +120,7 @@ jobs:
brew list glfw || brew install glfw
brew list libuv || brew install libuv

- name: Install dependencies
- name: Install dependencies Linux
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
Expand All @@ -128,11 +139,6 @@ jobs:
libc++-9-dev \
libc++abi-9-dev
/usr/sbin/update-ccache-symlinks

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: npm ci
run: npm ci --ignore-scripts
Expand All @@ -159,7 +165,7 @@ jobs:
ccache --show-stats --set-config cache_dir=~/.ccache

- name: CMake
if: runner.os == 'macOS'
if: runner.os == 'MacOS'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DMBGL_WITH_COVERAGE=ON

Expand Down
97 changes: 61 additions & 36 deletions .github/workflows/node-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ jobs:
git push

build:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
os:
- macos-12
- ubuntu-20.04
node: [ 14, 16, 18 ]
name: OS ${{ matrix.os }} Node ${{ matrix.node }}
runs-on: ${{ matrix.os }}
include:
- runs-on: ubuntu-20.04
arch: x86_64
- runs-on: macos-12
arch: x86_64
- runs-on: macos-12-arm
arch: arm64
needs: bump_version
continue-on-error: true
env:
Expand All @@ -69,7 +72,15 @@ jobs:
- name: Get Latest Version
run: git pull

- name: Install dependencies
- name: Get OS Architecture
run: uname -m

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies macOS
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
Expand All @@ -79,10 +90,10 @@ jobs:
brew list ccache || brew install ccache
brew list ninja || brew install ninja
brew list pkg-config || brew install pkg-config
brew list glfw3 || brew install glfw3
brew list glfw || brew install glfw
brew list libuv || brew install libuv

- name: Install dependencies
- name: Install dependencies Linux
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
Expand All @@ -101,11 +112,6 @@ jobs:
libc++-9-dev \
libc++abi-9-dev
/usr/sbin/update-ccache-symlinks

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: npm ci
run: npm ci --ignore-scripts
Expand All @@ -114,7 +120,7 @@ jobs:
run: ccache --clear --set-config cache_dir=~/.ccache

- name: Cache ccache
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: ccache-v1
with:
Expand All @@ -132,11 +138,9 @@ jobs:
ccache --show-stats --set-config cache_dir=~/.ccache

- name: CMake
if: runner.os == 'macOS'
if: runner.os == 'MacOS'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DMBGL_WITH_COVERAGE=ON
sed -i -e 's/$(ARCHS_STANDARD)/x86_64/g' build/build.ninja
sed -i -e 's/-arch arm64e/-arch x86_64/g' build/build.ninja

- name: CMake
if: runner.os == 'Linux'
Expand All @@ -147,26 +151,48 @@ jobs:
run: |
cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null)

- name: Test
if: runner.os == 'Linux'
run: xvfb-run --auto-servernum npm test

- name: Test
if: runner.os == 'macOS'
run: npm test

- name: Pack
if: github.ref != 'refs/heads/main'
#- name: Run render tests on macOS
# if: runner.os == 'macOS'
# run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json

#- name: Upload render test artifacts
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: render-query-test-results
# path: metrics/macos-xcode11-release-style.html

#- name: Test
# if: runner.os == 'Linux'
# run: xvfb-run --auto-servernum npm test

#- name: Test
# if: runner.os == 'macOS' && matrix.arch != 'arm64'
# run: npm test

# On PRs make sure that the npm package can be packaged.
#- name: Pack
# if: github.ref != 'refs/heads/main'
# run: |
# npm pack --dry-run

- name: Publish X64 Release to Github
if: github.ref == 'refs/heads/main' && matrix.arch == 'x86_64'
env:
PUBLISH: true
BUILDTYPE: RelWithDebInfo
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }}
run: |
npm pack --dry-run
./platform/node/scripts/publish.sh

- name: Publish Release to Github
if: github.ref == 'refs/heads/main'
run: |
npm run package
npm run release
- name: Publish ARM Release to Github
if: github.ref == 'refs/heads/main' && matrix.arch == 'arm64'
env:
PUBLISH: true
BUILDTYPE: RelWithDebInfo
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }}
run: |
./platform/node/scripts/publish.sh --target_arch=arm64

- name: Publish to NPM (release)
if: matrix.os == 'ubuntu-20.04' && matrix.node == '18' && github.ref == 'refs/heads/main' && github.event.inputs.version != 'prerelease'
Expand All @@ -182,5 +208,4 @@ jobs:
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --tag next --access public
env:
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}

NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"license": "BSD-2-Clause",
"dependencies": {
"@mapbox/cmake-node-module": "^1.2.0",
"@mapbox/node-pre-gyp": "^1.0.10",
"@acalcutt/node-pre-gyp": "^1.0.10",
"@acalcutt/node-pre-gyp-github": "1.4.8",
"minimatch": "^5.1.0",
"npm-run-all": "^4.0.2"
Expand Down
10 changes: 7 additions & 3 deletions platform/node/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ if [[ "${CIRCLE_TAG}" == "node-v${PACKAGE_JSON_VERSION}" ]] || [[ "${PUBLISH:-}"
# Changes to the version targets here should happen in tandem with updates to the
# EXCLUDE_NODE_ABIS property in cmake/node.cmake and the "node" engines property in
# package.json.
for TARGET in 6.0.0 8.0.0 10.0.0; do
for TARGET in 14.0.0 16.0.0 18.0.0; do
rm -rf build/stage

if [[ "${BUILDTYPE}" == "RelWithDebInfo" ]]; then
./node_modules/.bin/node-pre-gyp package publish info --target="${TARGET}"
./node_modules/.bin/node-pre-gyp package --target="${TARGET}" $@
./node_modules/.bin/node-pre-gyp-github publish --release
elif [[ "${BUILDTYPE}" == "Debug" ]]; then
./node_modules/.bin/node-pre-gyp package publish info --target="${TARGET}" --debug
./node_modules/.bin/node-pre-gyp package --target="${TARGET}" --debug $@
./node_modules/.bin/node-pre-gyp-github publish --release
else
echo "error: must provide either Debug or RelWithDebInfo for BUILDTYPE"
exit 1
Expand Down