Skip to content

Commit

Permalink
chore: create GitHub action to update the canary branch (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
targos authored Apr 11, 2021
1 parent 2351073 commit 3e6ec77
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/update-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update canary branch

on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:

jobs:
updateCanary:
name: Update the canary branch
if: github.repository == 'nodejs/node-v8' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Clone node-v8
uses: actions/checkout@v2
with:
path: node-v8
token: ${{ secrets.CANARY_UPDATE }}

- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 14.x

- name: Install dependencies
run: npm install -g node-core-utils@latest

- name: Cache V8 clone
uses: actions/cache@v2
with:
path: v8
key: v8-clone

- name: Execute the update script
run: ./node-v8/tools/update-canary.sh

- name: Notify Slack on failure
if: ${{ failure() }}
run: |
ACTIONS_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}?check_suite_focus=true"
SLACK_PAYLOAD="{\"username\": \"canary_bot\", \"text\": \"*Canary update failed!*\n\nRun: ${ACTIONS_URL}\", \"icon_emoji\": \":bell:\"}"
curl -X POST --data-urlencode "payload=${SLACK_PAYLOAD}" ${{ secrets.SLACK_WEBHOOK }}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Node.js V8 canary

This is an automatically updated **experimental** version of [Node.js][] with
the `lkgr` (last known good revision) of V8.

The daily builds of this repo can be found at [`v8-canary`][].

**Do not use this in production!**

This repository is not owned by `@nodejs/v8`, but they might be able to help
with issues.

This project is bound by a [Code of Conduct][].

[Code of Conduct]: https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md
[Node.js]: https://github.com/nodejs/node
[`v8-canary`]: https://nodejs.org/download/v8-canary/
29 changes: 29 additions & 0 deletions tools/update-canary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -ex

cd node-v8

git remote add upstream https://github.com/nodejs/node.git
git fetch upstream master
git fetch upstream canary-base

git config user.name "Node.js GitHub Bot"
git config user.email [email protected]

git reset --hard upstream/master

# Update V8 to the lkgr branch
git-node v8 major --branch=lkgr --base-dir="$GITHUB_WORKSPACE"

# Cherry-pick the floating V8 patches Node.js maintains on master.
# Canary-base is the last good version of canary, and is manually updated with any V8 patches or backports.
git cherry-pick `git log upstream/canary-base -1 --format=format:%H --grep "src: update NODE_MODULE_VERSION"`...upstream/canary-base

# Verify that Node.js can be compiled and executed
python3 ./configure
make -j $(getconf _NPROCESSORS_ONLN) V=
out/Release/node test/parallel/test-process-versions.js

# Force-push to the canary branch.
git push --force origin HEAD:canary

0 comments on commit 3e6ec77

Please sign in to comment.