-
Notifications
You must be signed in to change notification settings - Fork 177
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
Improve binary build workflow for cross-platform releases #2315
Merged
Merged
Changes from all commits
Commits
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 |
---|---|---|
|
@@ -18,9 +18,13 @@ jobs: | |
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
arch: amd64 | ||
- os: macos-13 | ||
arch: amd64 | ||
- os: ubuntu-arm64-4-core | ||
arch: arm64 | ||
- os: macos-latest | ||
arch: arm64 | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
|
@@ -29,46 +33,67 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
|
||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Cache Rust dependencies | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: | | ||
vm/rust | ||
core/rust | ||
starknet/compiler/rust | ||
- name: Get latest tag | ||
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV | ||
|
||
- name: Get artifact name | ||
run: echo "ARTIFACT_NAME=juno-${{ env.TAG }}-${{ runner.os }}-$(uname -m)" >> $GITHUB_ENV | ||
run: | | ||
OS_NAME=$([ "${{ runner.os }}" == "macOS" ] && echo "darwin" || echo "linux") | ||
echo "ARTIFACT_NAME=juno-${{ env.TAG }}-${OS_NAME}-${{ matrix.arch }}" >> $GITHUB_ENV | ||
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. why relying on |
||
- name: Install dependencies (Linux) | ||
if: runner.os == 'Linux' | ||
run: sudo apt-get update -qq && sudo apt-get install -y upx-ucl build-essential cargo git golang libjemalloc-dev libjemalloc2 -y | ||
run: | | ||
sudo apt-get update -qq | ||
sudo apt-get install -y upx-ucl libjemalloc-dev libjemalloc2 libbz2-dev | ||
- name: Install dependencies (macOS) | ||
if: runner.os == 'macOS' | ||
run: brew install cargo-c jemalloc | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
run: brew install jemalloc | ||
kirugan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Build Juno | ||
- name: Build binary | ||
run: make juno | ||
|
||
- name: Compress binary (Linux) | ||
if: runner.os == 'Linux' | ||
run: | | ||
make juno | ||
if [[ "${{ runner.os }}" != "macOS" ]]; then | ||
upx build/juno | ||
fi | ||
upx build/juno | ||
kirugan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mv build/juno ${{ env.ARTIFACT_NAME }} | ||
- name: Generate Checksum | ||
id: checksum | ||
- name: Prepare binary (macOS) | ||
if: runner.os == 'macOS' | ||
run: mv build/juno ${{ env.ARTIFACT_NAME }} | ||
|
||
- name: Generate checksum | ||
run: | | ||
if [[ "${{ runner.os }}" == "macOS" ]]; then | ||
shasum -a 256 ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256 | ||
else | ||
sha256sum ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256 | ||
fi | ||
- name: Upload Artifact | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.ARTIFACT_NAME }} | ||
path: | | ||
${{ env.ARTIFACT_NAME }} | ||
${{ env.ARTIFACT_NAME }}.sha256 | ||
retention-days: 30 |
Oops, something went wrong.
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.
could probably also change the
runner.os
to beuname -o