diff --git a/bare-base/action.yml b/bare-base/action.yml index 687a269..b5effd9 100644 --- a/bare-base/action.yml +++ b/bare-base/action.yml @@ -15,6 +15,16 @@ inputs: description: Optional scope for scoped registries (e.g. @myorg) node-auth-token: description: npm auth token + source: + description: Compile Bare from source instead of installing the prebuilt runtime + default: false + ref: + description: The `holepunchto/bare` git ref (branch, tag, or SHA) to compile when building from source + flags: + description: Additional flags to pass to the build system when compiling from source + path: + description: The directory to check out and build the Bare source in when compiling from source + default: .bare runs: using: composite @@ -27,3 +37,8 @@ runs: scope: ${{ inputs.scope }} node-auth-token: ${{ inputs.node-auth-token }} - uses: holepunchto/actions/setup-bare@v1 + with: + source: ${{ inputs.source }} + ref: ${{ inputs.ref }} + flags: ${{ inputs.flags }} + path: ${{ inputs.path }} diff --git a/compile-bare/action.yml b/compile-bare/action.yml new file mode 100644 index 0000000..b0b9951 --- /dev/null +++ b/compile-bare/action.yml @@ -0,0 +1,39 @@ +name: Compile Bare +description: Check out and compile Bare from source, installing it onto PATH + +inputs: + ref: + description: The `holepunchto/bare` git ref (branch, tag, or SHA) to compile + flags: + description: Additional flags to pass to the build system (e.g. `--sanitize address`) + path: + description: The directory to check out and build the Bare source in + default: .bare + +runs: + using: composite + steps: + - uses: holepunchto/actions/setup-llvm@v1 + - uses: holepunchto/actions/setup-nasm@v1 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: holepunchto/bare + ref: ${{ inputs.ref }} + path: ${{ inputs.path }} + persist-credentials: false + - run: npm install --ignore-scripts + working-directory: ${{ inputs.path }} + shell: bash + - id: prefix + run: echo "path=$(npm prefix --global)" >> "$GITHUB_OUTPUT" + shell: bash + - uses: holepunchto/actions/compile-prebuilds@v1 + with: + flags: ${{ inputs.flags }} + path: ${{ inputs.path }} + prefix: ${{ steps.prefix.outputs.path }} + - run: cp "$PREFIX/bin/bare.exe" "$PREFIX/" + if: ${{ runner.os == 'Windows' }} + env: + PREFIX: ${{ steps.prefix.outputs.path }} + shell: bash diff --git a/compile-prebuilds/action.yml b/compile-prebuilds/action.yml index 5a7851f..d7026cf 100644 --- a/compile-prebuilds/action.yml +++ b/compile-prebuilds/action.yml @@ -4,10 +4,8 @@ description: Compile and optionally upload native prebuilds inputs: platform: description: The platform to compile for - required: true arch: description: The architecture to compile for - required: true flags: description: Additional flags to apply to the build system tags: @@ -15,6 +13,9 @@ inputs: prefix: description: The prebuild prefix default: prebuilds + path: + description: The directory containing the source tree to compile + default: . upload: description: Upload the compiled prebuilds default: false @@ -24,17 +25,20 @@ runs: steps: - run: npm install --global bare-make shell: bash - - run: bare-make generate --platform $PLATFORM --arch $ARCH $FLAGS + - run: bare-make generate ${PLATFORM:+--platform $PLATFORM} ${ARCH:+--arch $ARCH} $FLAGS env: PLATFORM: ${{ inputs.platform }} ARCH: ${{ inputs.arch }} FLAGS: ${{ inputs.flags }} + working-directory: ${{ inputs.path }} shell: bash - run: bare-make build + working-directory: ${{ inputs.path }} shell: bash - run: bare-make install --prefix $PREFIX env: PREFIX: ${{ inputs.prefix }} + working-directory: ${{ inputs.path }} shell: bash - uses: holepunchto/actions/upload-prebuilds@v1 if: ${{ inputs.upload == 'true' }} @@ -42,4 +46,4 @@ runs: platform: ${{ inputs.platform }} arch: ${{ inputs.arch }} tags: ${{ inputs.tags }} - prefix: ${{ inputs.prefix }} + prefix: ${{ format('{0}/{1}', inputs.path, inputs.prefix) }} diff --git a/setup-bare/action.yml b/setup-bare/action.yml index ec84d73..d3f1bab 100644 --- a/setup-bare/action.yml +++ b/setup-bare/action.yml @@ -1,8 +1,27 @@ name: Setup Bare -description: Install and configure Bare +description: Install and configure Bare, optionally compiling a build from source + +inputs: + source: + description: Compile Bare from source instead of installing the prebuilt runtime + default: false + ref: + description: The `holepunchto/bare` git ref (branch, tag, or SHA) to compile when building from source + flags: + description: Additional flags to pass to the build system when compiling from source + path: + description: The directory to check out and build the Bare source in when compiling from source + default: .bare runs: using: composite steps: - run: npm install --global bare-runtime + if: ${{ inputs.source != 'true' }} shell: bash + - uses: holepunchto/actions/compile-bare@v1 + if: ${{ inputs.source == 'true' }} + with: + ref: ${{ inputs.ref }} + flags: ${{ inputs.flags }} + path: ${{ inputs.path }}