-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1014 from neon-bindings/create-neon-lib
`npm init neon --lib`
- Loading branch information
Showing
33 changed files
with
5,238 additions
and
264 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,3 @@ | ||
[workspace] | ||
members = ["crates/{{package.name}}"] | ||
resolver = "2" |
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,5 @@ | ||
NODE_VERSION={{versions.node}}.x | ||
NPM_REGISTRY=https://registry.npmjs.org | ||
RUST_VERSION=stable | ||
ACTIONS_USER=github-actions | ||
[email protected] |
137 changes: 137 additions & 0 deletions
137
pkgs/create-neon/data/templates/ci/github/build.yml.hbs
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,137 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
description: 'The branch, tag, or SHA to check out' | ||
required: true | ||
type: string | ||
update-version: | ||
description: 'Update version before building?' | ||
required: false | ||
type: boolean | ||
default: false | ||
version: | ||
description: 'Version update (ignored if update-version is false)' | ||
required: false | ||
type: string | ||
default: 'patch' | ||
github-release: | ||
description: 'Publish GitHub release?' | ||
required: false | ||
type: boolean | ||
default: false | ||
tag: | ||
description: 'The release tag (ignored if github-release is false)' | ||
required: false | ||
type: string | ||
default: '' | ||
|
||
jobs: | ||
matrix: | ||
name: Matrix | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: {{#$}} steps.matrix.outputs.result {{/$}} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@{{versions.actions.verified.checkout}} | ||
with: | ||
ref: {{#$}} inputs.ref {{/$}} | ||
- name: Setup Neon Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
use-rust: false | ||
- name: Look Up Matrix Data | ||
id: matrixData | ||
shell: bash | ||
run: echo "json=$(npx neon show ci github | jq -rc)" | tee -a $GITHUB_OUTPUT | ||
- name: Compute Matrix | ||
id: matrix | ||
uses: actions/github-script@{{versions.actions.verified.githubScript}} | ||
with: | ||
script: | | ||
const platforms = {{#$}} steps.matrixData.outputs.json {{/$}}; | ||
const macOS = platforms.macOS.map(platform => { | ||
return { os: "macos-latest", platform, script: "build" }; | ||
}); | ||
const windows = platforms.Windows.map(platform => { | ||
return { os: "windows-latest", platform, script: "build" }; | ||
}); | ||
const linux = platforms.Linux.map(platform => { | ||
return { os: "ubuntu-latest", platform, script: "cross" }; | ||
}); | ||
return [...macOS, ...windows, ...linux]; | ||
|
||
binaries: | ||
name: Binaries | ||
needs: [matrix] | ||
strategy: | ||
matrix: | ||
cfg: {{#$}} fromJSON(needs.matrix.outputs.matrix) {{/$}} | ||
runs-on: {{#$}} matrix.cfg.os {{/$}} | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@{{versions.actions.verified.checkout}} | ||
with: | ||
ref: {{#$}} inputs.ref {{/$}} | ||
- name: Setup Neon Environment | ||
id: neon | ||
uses: ./.github/actions/setup | ||
with: | ||
use-cross: {{#$}} matrix.cfg.script == 'cross' {{/$}} | ||
platform: {{#$}} matrix.cfg.platform {{/$}} | ||
- name: Update Version | ||
if: {{#$}} inputs.update-version {{/$}} | ||
shell: bash | ||
run: | | ||
git config --global user.name $ACTIONS_USER | ||
git config --global user.email $ACTIONS_EMAIL | ||
npm version {{#$}} inputs.version {{/$}} -m "v%s" | ||
- name: Build | ||
shell: bash | ||
env: | ||
CARGO_BUILD_TARGET: {{#$}} steps.neon.outputs.target {{/$}} | ||
NEON_BUILD_PLATFORM: {{#$}} matrix.cfg.platform {{/$}} | ||
run: npm run {{#$}} matrix.cfg.script {{/$}} | ||
- name: Pack | ||
id: pack | ||
shell: bash | ||
run: | | ||
mkdir -p dist | ||
echo filename=$(basename $(npm pack ./platforms/{{#$}} matrix.cfg.platform {{/$}} --silent --pack-destination=./dist --json | jq -r '.[0].filename')) | tee -a $GITHUB_OUTPUT | ||
- name: Release | ||
if: {{#$}} inputs.github-release {{/$}} | ||
uses: softprops/action-gh-release@{{versions.actions.unverified.ghRelease.sha}} # {{versions.actions.unverified.ghRelease.tag}} | ||
with: | ||
files: ./dist/{{#$}} steps.pack.outputs.filename {{/$}} | ||
tag_name: {{#$}} inputs.tag {{/$}} | ||
|
||
main: | ||
name: Main | ||
needs: [matrix] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@{{versions.actions.verified.checkout}} | ||
with: | ||
ref: {{#$}} inputs.ref {{/$}} | ||
- name: Setup Neon Environment | ||
uses: ./.github/actions/setup | ||
with: | ||
use-rust: false | ||
- name: Pack | ||
id: pack | ||
shell: bash | ||
run: | | ||
mkdir -p dist | ||
echo "filename=$(npm pack --silent --pack-destination=./dist)" | tee -a $GITHUB_OUTPUT | ||
- name: Release | ||
if: {{#$}} inputs.github-release {{/$}} | ||
uses: softprops/action-gh-release@{{versions.actions.unverified.ghRelease.sha}} # {{versions.actions.unverified.ghRelease.tag}} | ||
with: | ||
files: ./dist/{{#$}} steps.pack.outputs.filename {{/$}} | ||
tag_name: {{#$}} inputs.tag {{/$}} |
Oops, something went wrong.