-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06a3116
commit 4377a2d
Showing
4 changed files
with
251 additions
and
1 deletion.
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,58 @@ | ||
name: "Setup and build the repo" | ||
description: "A task to reuse setup steps during multiple jobs" | ||
inputs: | ||
node: | ||
description: Node version | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{inputs.node}} | ||
check-latest: true | ||
cache: yarn | ||
|
||
- name: Node.js version | ||
id: node | ||
shell: bash | ||
run: echo "v8CppApiVersion=$(node --print "process.versions.modules")" >> $GITHUB_OUTPUT | ||
|
||
- name: Restore build | ||
uses: actions/cache/restore@v4 | ||
id: cache-build-restore | ||
with: | ||
path: | | ||
node_modules | ||
packages/*/node_modules | ||
lib/ | ||
packages/*/lib | ||
packages/*/.git-data.json | ||
key: ${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node }}-${{ github.sha }} | ||
|
||
- name: Install & build | ||
if: steps.cache-build-restore.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: yarn install --frozen-lockfile && yarn build | ||
|
||
- name: Build | ||
if: steps.cache-build-restore.outputs.cache-hit == 'true' | ||
shell: bash | ||
run: yarn build | ||
|
||
- name: Check Build | ||
shell: bash | ||
run: yarn check-build | ||
|
||
- name: Cache build artifacts | ||
uses: actions/cache@master | ||
with: | ||
path: | | ||
node_modules | ||
packages/*/node_modules | ||
lib/ | ||
packages/*/lib | ||
packages/*/.git-data.json | ||
key: ${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node }}-${{ github.sha }} |
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,56 @@ | ||
name: Build binaries | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
binaries: | ||
name: Build skandha binaries | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
platform: linux | ||
arch: amd64 | ||
- os: skandha-arm64-runner | ||
platform: linux | ||
arch: arm64 | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install arm64 specifics | ||
if: matrix.arch == 'arm64' | ||
run: |- | ||
# Install missing yarn | ||
# See https://github.com/github-early-access/arm-runners-beta/issues/5 | ||
curl -fsSL --create-dirs -o $HOME/bin/yarn \ | ||
https://github.com/yarnpkg/yarn/releases/download/v1.22.22/yarn-1.22.22.js | ||
chmod +x $HOME/bin/yarn | ||
echo "$HOME/bin" >> $GITHUB_PATH | ||
# Install missing build-essential | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential | ||
- uses: "./.github/actions/setup-and-build" | ||
with: | ||
node: 20 | ||
- run: | | ||
mkdir -p dist | ||
yarn global add [email protected] | ||
npx caxa -m "Unpacking skandha binary, please wait..." -D -p "yarn install --frozen-lockfile --production" --input . --output "skandha" -- "{{caxa}}/node_modules/.bin/node" "--max-old-space-size=8192" "{{caxa}}/node_modules/.bin/skandha" | ||
tar -czf "dist/skandha-${{ inputs.version }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" "skandha" | ||
- name: Upload binaries | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: binaries-${{ matrix.os }} | ||
path: dist/ | ||
if-no-files-found: error |
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
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,46 @@ | ||
/* eslint-disable no-console, | ||
@typescript-eslint/explicit-function-return-type, | ||
@typescript-eslint/no-var-requires, | ||
@typescript-eslint/no-require-imports */ | ||
|
||
// Script used in .github/workflows/release.yml to get the previous tag | ||
// to generate a changelog from 'prev_tag' to 'tag' | ||
// Returns the most recent tag that: | ||
// - is not equal to CURRENT_TAG | ||
// - does not contain IGNORE_PATTERN | ||
// | ||
// Outputs to output.prev_tag | ||
|
||
const { exec } = require("node:child_process"); | ||
const { promisify } = require("node:util"); | ||
|
||
async function run() { | ||
const { CURRENT_TAG, IGNORE_PATTERN } = process.env; | ||
if (!CURRENT_TAG) throw Error("CURRENT_TAG must be defined"); | ||
if (!IGNORE_PATTERN) throw Error("IGNORE_PATTERN must be defined"); | ||
|
||
const { stdout } = await promisify(exec)("git tag --sort=-version:refname"); | ||
// Returns sorted list of tags | ||
// v0.32.0 | ||
// v0.31.0 | ||
// v0.30.0 | ||
// v0.29.3 | ||
|
||
// Pick the first tag that doesn't match current tag | ||
const tags = stdout.trim().split("\n"); | ||
for (const tag of tags) { | ||
if (tag !== CURRENT_TAG && !tag.includes(IGNORE_PATTERN)) { | ||
const cmd = `echo "prev_tag=${tag}" >> ${process.env.GITHUB_OUTPUT}`; | ||
console.log("Execute command on shell", cmd); | ||
await promisify(exec)(cmd); | ||
return; | ||
} | ||
} | ||
|
||
throw Error("No tag found"); | ||
} | ||
|
||
run().catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |