-
Notifications
You must be signed in to change notification settings - Fork 10
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 binaries on publish for Linux and macOS #44
Closed
Closed
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
8c41d17
Add build workflow
b62c2cc
Merge with main build script
444b330
Run pnpx
bfe75fa
Install pnpm with corepack
8ecea18
Install deps
9e4e68b
Update rust build
2561761
Specity linker and cross compiler env vars
44091bd
Try setting CXX compiler
27ba43f
Enable x86_64
d3ceff3
Add build step, update to c2pa 0.28.1
e77ed14
Build for mac
e386ca2
Revert c2pa version for now
222224b
Upgrade to c2pa 0.27.1
98f9d44
Build mac binaries
346e466
Add windows build for x86_64
c0010bc
Fix target definition
295e33c
update win build
3965857
Run win build on linux
f3a090e
Skip windows build for now
c0434d7
Build binaries on publish (#45)
908644e
Merge branch 'main' into build-binaries
8a14104
Update release-binaries.yml
4bbc6b7
Update macOS runners, pull request filtering
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
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,107 @@ | ||
name: Build release binaries | ||
|
||
on: | ||
release: | ||
types: ['created'] | ||
|
||
jobs: | ||
build-binaries: | ||
name: Build binaries for ${{matrix.target}} | ||
runs-on: ${{matrix.runner}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- runner: ubuntu-latest | ||
target: aarch64-unknown-linux-gnu | ||
- runner: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- runner: macos-latest | ||
target: aarch64-apple-darwin | ||
- runner: macos-latest | ||
target: x86_64-apple-darwin | ||
# - runner: ubuntu-latest | ||
# target: x86_64-pc-windows-gnu | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install system deps (aarch64-unknown-linux-gnu) | ||
if: ${{matrix.target == 'aarch64-unknown-linux-gnu'}} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross | ||
|
||
- name: Install system deps (x86_64-pc-windows-gnu) | ||
if: ${{matrix.target == 'x86_64-pc-windows-gnu'}} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libz-mingw-w64-dev g++-mingw-w64-x86-64 | ||
|
||
- name: Install Rust toolchain | ||
uses: dtolnay/[email protected] | ||
with: | ||
components: llvm-tools-preview | ||
target: ${{matrix.target}} | ||
|
||
- name: Install pnpm | ||
run: | | ||
corepack enable | ||
corepack prepare pnpm@latest --activate | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Cache Rust dependencies | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: ${{matrix.target}} | ||
|
||
- name: Build library for aarch64-unknown-linux-gnu | ||
if: ${{matrix.target == 'aarch64-unknown-linux-gnu'}} | ||
env: | ||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | ||
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc | ||
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++ | ||
run: | | ||
mkdir -p generated/${{matrix.target}} | ||
pnpm run build:rust --target=${{matrix.target}} | ||
mv generated/c2pa.node generated/${{matrix.target}}/c2pa.node | ||
|
||
- name: Build library for x86_64-pc-windows-gnu | ||
if: ${{matrix.target == 'x86_64-pc-windows-gnu'}} | ||
env: | ||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: x86_64-w64-mingw32-gcc | ||
CC_aarch64_unknown_linux_gnu: x86_64-w64-mingw32-gcc | ||
CXX_aarch64_unknown_linux_gnu: x86_64-w64-mingw32-g++ | ||
run: | | ||
mkdir -p generated/${{matrix.target}} | ||
pnpm run build:rust --target=${{matrix.target}} | ||
mv generated/c2pa.node generated/${{matrix.target}}/c2pa.node | ||
|
||
- name: Build library | ||
id: build-library | ||
if: ${{!contains(fromJSON('["aarch64-unknown-linux-gnu", "x86_64-pc-windows-gnu"]'), matrix.target)}} | ||
run: | | ||
mkdir -p generated/${{matrix.target}} | ||
pnpm run build:rust --target=${{matrix.target}} | ||
cd generated | ||
tar cvfz c2pa-node_${{matrix.target}}-${{ github.event.release.tag_name }}.tar.gz c2pa.node | ||
echo "archive=c2pa-node_${{matrix.target}}-${{ github.event.release.tag_name }}.tar.gz" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Upload release asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: generated/${{ steps.build-library.outputs.archive }} | ||
asset_name: ${{ steps.build-library.outputs.archive }} | ||
asset_content_type: application/tar+gzip |
Oops, something went wrong.
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.
This is incorrect but I can fix it once I enable windows builds