Skip to content
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(release): add macos support #75

Merged
merged 5 commits into from
Apr 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 49 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,83 @@ on:
ref:
description: ref to build binary from
required: false
push:
branches:
- 'frank/build-macos'

jobs:
build-node:
runs-on: ubuntu-22.04
runs-on: ${{ matrix.platform.os }}
permissions:
contents: write
strategy:
matrix:
cpu: [ "", "skylake" ]
platform:
# Linux
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
cpu: skylake
# macOS
- os: macos-14
target: aarch64-apple-darwin
- os: macos-14
target: x86_64-apple-darwin
env:
RUSTFLAGS: "-C target-cpu=${{ matrix.cpu }}"
name: "pop-node${{ matrix.cpu != '' && format('-{0}', matrix.cpu) || '' }}"
RUSTFLAGS: "${{ matrix.platform.cpu != '' && format('-C target-cpu={0}', matrix.platform.cpu) || '' }} ${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' && '-C linker=aarch64-linux-gnu-gcc' || '' }}"
path: "target/${{ matrix.platform.target }}/production"
package: "pop-node-${{ matrix.platform.target }}${{ matrix.platform.cpu != '' && format('-{0}', matrix.platform.cpu) || '' }}.tar.gz"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.ref }}

- name: Install packages
- name: Install packages (Linux)
if: contains(matrix.platform.target, 'linux')
run: |
sudo apt-get install -y protobuf-compiler
sudo apt-get install -y protobuf-compiler ${{ contains(matrix.platform.target, 'aarch64') && 'crossbuild-essential-arm64' || '' }}
protoc --version
- name: Install packages (macOS)
if: contains(matrix.platform.target, 'apple')
run: |
brew install protobuf
protoc --version
- name: Add target
run: rustup target add ${{ matrix.platform.target }}

- name: Build node
run: cargo build --profile=production -p pop-node
run: cargo build --profile=production -p pop-node --target ${{ matrix.platform.target }} --features paseo

- name: Package binary (Linux)
if: contains(matrix.platform.target, 'linux')
run: |
cd ${{ env.path }}
sha256sum pop-node > pop-node.sha256
tar -czf ${{ env.package }} pop-node pop-node.sha256
- name: Save binary
- name: Package binary (macOS)
if: contains(matrix.platform.target, 'apple')
run: |
mkdir -p build
cp target/production/pop-node build/${{ env.name }}
sha256sum build/${{ env.name }} > build/${{ env.name }}.sha256
cd ${{ env.path }}
shasum -a 256 pop-node > pop-node.sha256
tar -czf ${{ env.package }} pop-node pop-node.sha256
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: binaries
path: build
path: ${{ env.path }}/${{ env.package }}

- name: Add binary to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
build/${{ env.name }}
build/${{ env.name }}.sha256
${{ env.path }}/${{ env.package }}
Loading