-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build sea for windows macos and linux #59
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,130 @@ | ||
name: Runtime Tests | ||
on: | ||
workflow_call: | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
build-seas: | ||
name: ${{ matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ['ubuntu-latest', 'macos-latest', '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 | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./dist/apps/cli/sea-prep.blob | ||
key: hdcli-sea-blob-${{ github.run_id }} | ||
enableCrossOsArchive: true | ||
|
||
- 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 }} | ||
enableCrossOsArchive: true | ||
|
||
- name: set the executable name | ||
id: set-os-nice-name | ||
uses: actions/github-script@v7 | ||
env: | ||
MATRIX_OS: ${{ matrix.os }} | ||
with: | ||
script: | | ||
const os = process.env.MATRIX_OS; | ||
let osNiceName = os.replace('-latest', ''); | ||
if (os === 'ubuntu-latest') { | ||
osNiceName = 'linux'; | ||
} | ||
return osNiceName; | ||
result-encoding: string | ||
|
||
- name: zip the sea binary | ||
if: matrix.os != 'windows-latest' | ||
run: zip -r hdcli-${{ steps.set-os-nice-name.outputs.result }}.zip ${{ steps.set-executable-name.outputs.result }} | ||
working-directory: ./dist/apps/cli | ||
shell: bash | ||
|
||
- name: zip the sea binary | ||
if: matrix.os == 'windows-latest' | ||
run: Compress-Archive -Path ${{ steps.set-executable-name.outputs.result }} -Destination hdcli-${{ steps.set-os-nice-name.outputs.result }}.zip | ||
working-directory: dist\apps\cli | ||
shell: pwsh | ||
|
||
- name: cache the zip | ||
uses: actions/cache/save@v4 | ||
with: | ||
key: hdcli-sea-${{ steps.set-os-nice-name.outputs.result }}-zip-${{ github.run_id }} | ||
path: ./dist/apps/cli/hdcli-${{ steps.set-os-nice-name.outputs.result }}.zip | ||
enableCrossOsArchive: true |
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 |
---|---|---|
|
@@ -12,13 +12,19 @@ jobs: | |
|
||
- uses: ./.github/workflows/composite/build | ||
|
||
verify: | ||
build-seas: | ||
needs: build | ||
uses: ./.github/workflows/build-seas.yml | ||
|
||
verify: | ||
needs: build-seas | ||
uses: ./.github/workflows/runtime-tests.yml | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: verify | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
|
@@ -47,3 +53,65 @@ jobs: | |
run: | | ||
npm version "${{ steps.release-version.outputs.result }}" --no-git-tag-version | ||
npm publish | ||
|
||
- name: restore the linux zip from cache | ||
uses: actions/cache/save@v4 | ||
with: | ||
key: hdcli-sea-linux-latest-zip-${{ github.run_id }} | ||
path: ./dist/apps/cli/hdcli-linux.zip | ||
enableCrossOsArchive: true | ||
|
||
- name: restore the macos zip from cache | ||
uses: actions/cache/save@v4 | ||
with: | ||
key: hdcli-sea-macos-zip-${{ github.run_id }} | ||
path: ./dist/apps/cli/hdcli-macos.zip | ||
enableCrossOsArchive: true | ||
|
||
- name: restore the windows zip from cache | ||
uses: actions/cache/save@v4 | ||
with: | ||
key: hdcli-sea-windows-zip-${{ github.run_id }} | ||
path: ./dist/apps/cli/hdcli.exe-windows.zip | ||
enableCrossOsArchive: true | ||
|
||
- name: create release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref_name }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: upload linux zip asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
asset_path: ./dist/apps/cli/hdcli-linux.zip | ||
asset_name: hdcli-linux.zip | ||
asset_content_type: application/zip | ||
|
||
- name: upload macos zip asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
asset_path: ./dist/apps/cli/hdcli-macos.zip | ||
asset_name: hdcli-macos.zip | ||
asset_content_type: application/zip | ||
|
||
- name: upload windows zip asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question regarding naming |
||
with: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
asset_path: ./dist/apps/cli/hdcli-windows.zip | ||
asset_name: hdcli-windows.zip | ||
asset_content_type: application/zip |
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 |
---|---|---|
|
@@ -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-ubuntu-latest-${{ github.run_id }} | ||
|
||
- name: setup local git repo | ||
run: | | ||
|
@@ -77,3 +77,49 @@ jobs: | |
|
||
- name: run the cli | ||
run: ./dist/apps/cli/hdcli report committers | ||
|
||
os: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | ||
name: node ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- 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: uncache build output | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./dist/apps/cli/${{ steps.set-executable-name.outputs.result }} | ||
key: hdcli-sea-${{ matrix.os }}-${{ github.run_id }} | ||
enableCrossOsArchive: true | ||
|
||
- name: setup local git repo | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github CI" | ||
git init | ||
echo "test" > test.txt | ||
git add . | ||
git commit -m "test commit" | ||
echo "test 2" > test.txt | ||
git add . | ||
git commit -m "test commit 2" | ||
|
||
- name: run the cli | ||
run: ./dist/apps/cli/${{ steps.set-executable-name.outputs.result }} report committers |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we name this token for what it is so we can find it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an org token, for making requests to github. It's used in many places/reposThis being a herodevs repo, I don't know anything about it.