Skip to content

Commit

Permalink
build sea for windows macos and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Brocco committed Jun 14, 2024
1 parent 541447e commit 238fad6
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 15 deletions.
100 changes: 99 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,104 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/workflows/composite/build

verify:
build-seas:
needs: build
name: ${{ matrix.os}}
strategy:
fail-fast: false
matrix:
# os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
os: ['windows-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-node@v4
with:
node-version: '22'

- name: set the executable name
id: set-executable-name
uses: actions/github-script@v7
env:
MATRIX_OS: ${{ matrix.os }}
with:
script: |
const os = process.env.MATRIX_OS;
let executableName = 'hdcli';
if (os === 'windows-latest') {
executableName = 'hdcli.exe';
}
return executableName;
result-encoding: string

- name: restore the sea blob from cache
if: matrix.os != 'windows-latest'
uses: actions/cache/restore@v4
with:
path: ./dist/apps/cli/sea-prep.blob
key: hdcli-sea-blob-${{ github.run_id }}

- name: restore the sea blob from cache
if: matrix.os == 'windows-latest'
uses: actions/cache/restore@v4
with:
path: dist\apps\cli\sea-prep.blob
key: hdcli-sea-blob-${{ github.run_id }}

- name: copy node to use to create sea
if: matrix.os != 'windows-latest'
run: cp $(command -v node) hdcli
working-directory: ./dist/apps/cli
shell: bash

- name: copy node to use to create sea
if: matrix.os == 'windows-latest'
run: node -e "require('fs').copyFileSync(process.execPath, 'hdcli.exe')"
working-directory: dist\apps\cli
shell: pwsh

- name: remove the signature of the binary
if: matrix.os == 'macos-latest'
run: codesign --remove-signature hdcli
working-directory: ./dist/apps/cli
shell: bash

- name: inject the CLI sea into the copied node
if: matrix.os == 'ubuntu-latest'
run: npx postject ${{ steps.set-executable-name.outputs.result }} NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
working-directory: ./dist/apps/cli
shell: bash

- name: inject the CLI sea into the copied node
if: matrix.os == 'windows-latest'
run: npx postject ${{ steps.set-executable-name.outputs.result }} NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
working-directory: dist\apps\cli
shell: pwsh

- name: inject the CLI sea into the copied node
if: matrix.os == 'macos-latest'
run: npx postject ${{ steps.set-executable-name.outputs.result }} NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA
working-directory: ./dist/apps/cli
shell: bash

- name: sign the binary
if: matrix.os == 'macos-latest'
run: codesign --sign - ${{ steps.set-executable-name.outputs.result }}
working-directory: ./dist/apps/cli
shell: bash

# would require a certificate to sign the binary on windows
# - name: sign the binary
# if: matrix.os == 'windows-latest'
# run: signtool sign /fd SHA256 ${{ steps.set-executable-name.outputs.result }}
# working-directory: dist\apps\cli
# shell: pwsh

- name: cache the sea binary
uses: actions/cache/save@v4
with:
path: ./dist/apps/cli/${{ steps.set-executable-name.outputs.result }}
key: hdcli-sea-${{ matrix.os }}-${{ github.run_id }}

verify:
needs: build-seas
uses: ./.github/workflows/runtime-tests.yml
16 changes: 3 additions & 13 deletions .github/workflows/composite/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,8 @@ runs:
working-directory: ./dist/apps/cli
shell: bash

- name: copy node to use to create sea
run: cp $(command -v node) hdcli
working-directory: ./dist/apps/cli
shell: bash

- name: inject the CLI sea into the copied node
run: npx postject hdcli NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
working-directory: ./dist/apps/cli
shell: bash

- name: cache the sea
- name: cache the sea blob
uses: actions/cache/save@v4
with:
path: ./dist/apps/cli/hdcli
key: hdcli-sea-${{ github.run_id }}
path: ./dist/apps/cli/sea-prep.blob
key: hdcli-sea-blob-${{ github.run_id }}
2 changes: 1 addition & 1 deletion .github/workflows/runtime-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ./dist/apps/cli/hdcli
key: hdcli-sea-${{ github.run_id }}
key: hdcli-sea-linux-${{ github.run_id }}

- name: setup local git repo
run: |
Expand Down

0 comments on commit 238fad6

Please sign in to comment.