Skip to content

Commit

Permalink
223 (#6)
Browse files Browse the repository at this point in the history
* bump default to pkg 5.8.1

* align pkg debugging with gha debugging

* align pkg debugging with gha debugging part 2

* align pkg debugging with gha debugging part 3

* align pkg debugging with gha debugging part 4

* align pkg debugging with gha debugging part 5

* align pkg debugging with gha debugging part 6

* align pkg debugging with gha debugging part 7

* align pkg debugging with gha debugging part 8

* align pkg debugging with gha debugging part 9

* align pkg debugging with gha debugging part 10

* align pkg debugging with gha debugging part 11

* align pkg debugging with gha debugging part 12

* align pkg debugging with gha debugging part 13

* align pkg debugging with gha debugging part 14

* align pkg debugging with gha debugging part 15

* align pkg debugging with gha debugging part 16

* align pkg debugging with gha debugging part 17

* align pkg debugging with gha debugging part 18

* align pkg debugging with gha debugging part 19

* align pkg debugging with gha debugging part 20

* align pkg debugging with gha debugging part 21

* align pkg debugging with gha debugging part 22

* align pkg debugging with gha debugging part 23

* align pkg debugging with gha debugging part 24

* align pkg debugging with gha debugging part 25

* align node version usage

* align node version usage part 2

* align node version usage part 3

* align node version usage part 4
  • Loading branch information
pirog authored Sep 28, 2023
1 parent c62f5a5 commit d96de10
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 41 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pr-func-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
basic-cross-platform-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-11
Expand All @@ -36,12 +37,13 @@ jobs:
basic-cross-everything-test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch:
- x64
- arm64
node-version:
- node16
- 16
os:
- linux
- macos
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/pr-test-inputs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: "TEST: should set the correct artifact-key"
if: always()
run: |
if [ "${{ steps.default-input-tests.outputs.artifact-key }}" == "pkg-action-node14-linux-x64-${{ github.sha }}" ]; then
if [ "${{ steps.default-input-tests.outputs.artifact-key }}" == "pkg-action-node16-linux-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Output artifact key set from defaults correctly"
else
echo "::error title=TEST FAILED!::Output artifact key not set correctly"
Expand Down Expand Up @@ -61,28 +61,28 @@ jobs:
if: always()
run: |
if [ "${{ matrix.arch }}" == "x64" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node14-linux-x64-${{ github.sha }}" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node16-linux-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Arch mapping from ${{ matrix.arch }} to x64 correctly"
else
echo "::error title=TEST FAILED!::Arch not mapping from ${{ matrix.arch }} to x64 correctly"
exit 1
fi
elif [ "${{ matrix.arch }}" == "amd64" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node14-linux-x64-${{ github.sha }}" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node16-linux-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Arch mapping from ${{ matrix.arch }} to x64 correctly"
else
echo "::error title=TEST FAILED!::Arch not mapping from ${{ matrix.arch }} to x64 correctly"
exit 2
fi
elif [ "${{ matrix.arch }}" == "arm64" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node14-linux-arm64-${{ github.sha }}" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node16-linux-arm64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Arch mapping from ${{ matrix.arch }} to arm64 correctly"
else
echo "::error title=TEST FAILED!::Arch not mapping from ${{ matrix.arch }} to arm64 correctly"
exit 3
fi
elif [ "${{ matrix.arch }}" == "aarch64" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node14-linux-arm64-${{ github.sha }}" ]; then
if [ "${{ steps.arch-input-tests.outputs.artifact-key }}" == "pkg-action-node16-linux-arm64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Arch mapping from ${{ matrix.arch }} to arm64 correctly"
else
echo "::error title=TEST FAILED!::Arch not mapping from ${{ matrix.arch }} to arm64 correctly"
Expand Down Expand Up @@ -115,21 +115,21 @@ jobs:
if: always()
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
if [ "${{ steps.runner-os-tests.outputs.artifact-key }}" == "pkg-action-node14-linux-x64-${{ github.sha }}" ]; then
if [ "${{ steps.runner-os-tests.outputs.artifact-key }}" == "pkg-action-node16-linux-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Runner OS mapping to linux correctly"
else
echo "::error title=TEST FAILED!::Runner OS mapping not mapping to linux correctly"
exit 1
fi
elif [ "${{ runner.os }}" == "macOS" ]; then
if [ "${{ steps.runner-os-tests.outputs.artifact-key }}" == "pkg-action-node14-macos-x64-${{ github.sha }}" ]; then
if [ "${{ steps.runner-os-tests.outputs.artifact-key }}" == "pkg-action-node16-macos-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Runner OS mapping to macos correctly"
else
echo "::error title=TEST FAILED!::Runner OS mapping not mapping to macos correctly"
exit 2
fi
elif [ "${{ runner.os }}" == "Windows" ]; then
if [ "${{ steps.runner-os-tests.outputs.artifact-key }}" == "pkg-action-node14-win-x64-${{ github.sha }}" ]; then
if [ "${{ steps.runner-os-tests.outputs.artifact-key }}" == "pkg-action-node16-win-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::Runner OS mapping to win correctly"
else
echo "::error title=TEST FAILED!::Runner OS mapping not mapping to win correctly"
Expand Down Expand Up @@ -162,21 +162,21 @@ jobs:
if: always()
run: |
if [ "${{ matrix.os }}" == "linux" ]; then
if [ "${{ steps.os-input-tests.outputs.artifact-key }}" == "pkg-action-node14-linux-x64-${{ github.sha }}" ]; then
if [ "${{ steps.os-input-tests.outputs.artifact-key }}" == "pkg-action-node16-linux-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::OS input ${{ matrix.os }} being used correctly"
else
echo "::error title=TEST FAILED!::OS input not being using ${{ matrix.os }} correctly"
exit 1
fi
elif [ "${{ matrix.os }}" == "macos" ]; then
if [ "${{ steps.os-input-tests.outputs.artifact-key }}" == "pkg-action-node14-macos-x64-${{ github.sha }}" ]; then
if [ "${{ steps.os-input-tests.outputs.artifact-key }}" == "pkg-action-node16-macos-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::OS input ${{ matrix.os }} being used correctly"
else
echo "::error title=TEST FAILED!::OS input not being using ${{ matrix.os }} correctly"
exit 2
fi
elif [ "${{ matrix.os }}" == "win" ]; then
if [ "${{ steps.os-input-tests.outputs.artifact-key }}" == "pkg-action-node14-win-x64-${{ github.sha }}" ]; then
if [ "${{ steps.os-input-tests.outputs.artifact-key }}" == "pkg-action-node16-win-x64-${{ github.sha }}" ]; then
echo "::notice title=TEST PASSED::OS input ${{ matrix.os }} being used correctly"
else
echo "::error title=TEST FAILED!::OS input not being using ${{ matrix.os }} correctly"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
- name: Prepare release
uses: lando/prepare-release-action@v2
with:
sync-tags: v2
sync-tags: v3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ typings/

.vscode
id_rsa
dist
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## v3.0.0 - [September 28, 2023](https://github.com/lando/pkg-action/releases/tag/v3.0.0)

### New Features

* Bumped default `pkg` input to `[email protected]`
* Bumped default `node-version` input to `16`
* Disabled `--debug` by default. Added support for debug toggling via https://github.blog/changelog/2022-05-24-github-actions-re-run-jobs-with-debug-logging
* Synced `node-version` usage so it is used in all relevant build environments

### **BREAKING CHANGES**

* `node-version` input is now just a major version eg `16` instead of `node16`

## v2.2.2 - [June 17, 2023](https://github.com/lando/pkg-action/releases/tag/v2.2.2)

* Switched release flow over to [@lando/prepare-release-action](https://github.com/lando/prepare-release-action)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ These keys are set to sane defaults but can be modified as needed.
|---|---|---|---|
| `arch` | The architecture to build for. | `amd64` | `x64` \| `amd64` \| `aarch64` \| `arm64` |
| `config` | The config file to use. | `package.json` | `config.json` |
| `node-version` | The node version to package with. | `node14` | `node8` \| `node10` \| `node12` \| `node14` \| `node16` \| `latest` |
| `node-version` | The node version to package with. | `16` | `8` \| `10` \| `12` \| `14` \| `16` |
| `options` | Additional options and flags to pass into pkg. | `null` | Additional [pkg options](https://github.com/vercel/pkg#usage) |
| `os` | The operating system to build for. | `${{ runner.os }}` | `linux` \| `macos` \| `win` |
| `pkg` | The version on @vercel/pkg to use. | `5.8.0` | `latest` |
| `pkg` | The version on @vercel/pkg to use. | `5.8.1` | `latest` |
| `upload` | Upload the artifacts. Useful if you need to grab them for downstream for things like code signing. | `true` | `false` \| `true` |

## Outputs
Expand All @@ -55,7 +55,7 @@ outputs:
```yaml
name: Package into node binary
uses: lando/pkg-action@v2
uses: lando/pkg-action@v3
with:
entrypoint: bin/cli
```
Expand All @@ -65,12 +65,12 @@ with:
**ALL OPTIONS**
```yaml
name: Package into node binary
uses: lando/pkg-action@v2
uses: lando/pkg-action@v3
with:
entrypoint: bin/cli
arch: arm64
config: package.json
node-version: node16
node-version: 14
options: -C
os: win
upload: false
Expand All @@ -85,7 +85,7 @@ strategy:
- x64
- arm64
node-version:
- node16
- 16
os:
- linux
- macos
Expand Down
62 changes: 42 additions & 20 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inputs:
node-version:
description: "The node version to package with"
required: false
default: node14
default: 16
options:
description: "Additional options and flags to pass into pkg"
required: false
Expand All @@ -32,7 +32,7 @@ inputs:
pkg:
description: "The version on @vercel/pkg to use"
required: false
default: "5.8.0"
default: "5.8.1"
test:
description: "Hidden flag for input testing"
default: false
Expand Down Expand Up @@ -86,13 +86,13 @@ runs:
echo "target-arch=${{ inputs.arch }}" >> $GITHUB_OUTPUT
fi
echo "target-node=${{ inputs.node-version }}" >> $GITHUB_OUTPUT
echo "target-node=node${{ inputs.node-version }}" >> $GITHUB_OUTPUT
echo "::endgroup::"
- name: Install node 16
- name: Install node ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: 16
node-version: ${{ inputs.node-version }}
cache: npm

- name: Install pkg ${{ inputs.pkg }}
Expand Down Expand Up @@ -122,20 +122,33 @@ runs:
- name: Run x64 pkg command
if: inputs.test != 'true' && steps.pkg-action-internal.outputs.target-arch == 'x64'
shell: bash
env:
RUNNER_DEBUG: ${{ env.RUNNER_DEBUG }}
run: |
pkg \
--config ${{ inputs.config }} \
--target=${{ steps.pkg-action-internal.outputs.target-node }}-${{ steps.pkg-action-internal.outputs.target-os }}-${{ steps.pkg-action-internal.outputs.target-arch }} \
--out-path dist \
--debug \
${{ inputs.options }} \
${{ inputs.entrypoint }}
if [ "$RUNNER_DEBUG" == 1 ] || [ "$RUNNER_DEBUG" == "1" ]; then
pkg \
--config ${{ inputs.config }} \
--target=${{ steps.pkg-action-internal.outputs.target-node }}-${{ steps.pkg-action-internal.outputs.target-os }}-${{ steps.pkg-action-internal.outputs.target-arch }} \
--out-path dist \
--debug \
${{ inputs.options }} \
${{ inputs.entrypoint }}
else
pkg \
--config ${{ inputs.config }} \
--target=${{ steps.pkg-action-internal.outputs.target-node }}-${{ steps.pkg-action-internal.outputs.target-os }}-${{ steps.pkg-action-internal.outputs.target-arch }} \
--out-path dist \
${{ inputs.options }} \
${{ inputs.entrypoint }}
fi
stat ${{ steps.pkg-action.outputs.file }}
- name: Run arm64 pkg command
if: inputs.test != 'true' && steps.pkg-action-internal.outputs.target-arch == 'arm64'
uses: uraimo/run-on-arch-action@v2
with:
env: |
RUNNER_DEBUG: "${{ env.RUNNER_DEBUG }}"
arch: aarch64
# @TODO: eventually we need to get this to work on ubuntu20.04 for build parity but we are using
# 18.04 because it was easier to get working, apparently there is a bug in 20.04s gpg?
Expand All @@ -144,21 +157,30 @@ runs:
# We need to install node and yarn "again" because they dont exist inside our build container
install: |
apt update && apt -y install curl
curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
curl -fsSL "https://deb.nodesource.com/setup_${{ inputs.node-version }}.x" | bash -
apt-get install -y nodejs
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt update && apt -y install yarn
yarn global add pkg@${{ inputs.pkg }} --prefix /usr/local
pkg --version
run: |
pkg \
--config ${{ inputs.config }} \
--target=${{ steps.pkg-action-internal.outputs.target-node }}-${{ steps.pkg-action-internal.outputs.target-os }}-${{ steps.pkg-action-internal.outputs.target-arch }} \
--out-path dist \
--debug \
${{ inputs.options }} \
${{ inputs.entrypoint }}
if [ "$RUNNER_DEBUG" == 1 ] || [ "$RUNNER_DEBUG" == "1" ]; then
pkg \
--config ${{ inputs.config }} \
--target=${{ steps.pkg-action-internal.outputs.target-node }}-${{ steps.pkg-action-internal.outputs.target-os }}-${{ steps.pkg-action-internal.outputs.target-arch }} \
--out-path dist \
--debug \
${{ inputs.options }} \
${{ inputs.entrypoint }}
else
pkg \
--config ${{ inputs.config }} \
--target=${{ steps.pkg-action-internal.outputs.target-node }}-${{ steps.pkg-action-internal.outputs.target-os }}-${{ steps.pkg-action-internal.outputs.target-arch }} \
--out-path dist \
${{ inputs.options }} \
${{ inputs.entrypoint }}
fi
stat ${{ steps.pkg-action.outputs.file }}
- name: Upload ${{ steps.pkg-action.outputs.artifact-key }}
Expand Down
5 changes: 3 additions & 2 deletions bin/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env node
const path = require('path');
const package = require(path.resolve(__dirname, '..', 'package.json'));

// @NOTE: This is used ONLY for self testing the action

const path = require('path');
const package = require(path.resolve(__dirname, '..', 'package.json'));

console.log(`v${package.version}`);

0 comments on commit d96de10

Please sign in to comment.