-
Notifications
You must be signed in to change notification settings - Fork 8
[WIP] GitHub Actions setup #6
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
base: main
Are you sure you want to change the base?
Changes from all commits
1e1b7bc
246bc74
e913382
4b98025
fc81af4
edcc2b7
06f8ca0
67a0063
502202e
22f3c1b
3deb403
4b10e33
388e69a
4406bdc
eea585c
61b8be0
93cdae8
5470996
7732df5
9aab7df
d641cca
86fe57e
556690b
74e83d3
acaf455
8a7f4f7
8c8f6c9
62b75c1
28d0e59
425bf3c
1557c78
ddadf1f
81a1793
1bb66c6
80b2f41
cf588cf
0a4277a
8283eec
99289eb
274d762
c6032f0
bea4575
35df133
68210b3
fde0033
4113bfa
3de4a5b
892a635
f3165ee
3090a8c
7a6fb0d
884e563
90c436a
ce471c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Build releases | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: macos-latest-large | ||
target: aarch64-apple-darwin | ||
- os: macos-latest-large | ||
target: aarch64-apple-ios | ||
- os: macos-latest-large | ||
# cross-compile for Linux ARM using Apple Silicon until we have ARM runners | ||
target: aarch64-unknown-linux-musl | ||
- os: macos-latest | ||
target: x86_64-apple-darwin | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
# - os: windows-latest | ||
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 is Windows disabled? That seems like a blocker. |
||
# target: x86_64-pc-windows-msvc | ||
name: Build ${{matrix.target}} | ||
runs-on: ${{matrix.os}} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get short SHA | ||
id: sha | ||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
|
||
- name: Install build tools (Linux) | ||
if: ${{matrix.os == 'ubuntu-latest'}} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install musl-tools | ||
|
||
- name: Install Rust toolchain | ||
uses: dtolnay/[email protected] | ||
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 fix on a specific Rust version? IMHO should matrix the MSRV version and stable. |
||
with: | ||
components: llvm-tools-preview | ||
target: ${{matrix.target}} | ||
|
||
- name: Install cbindgen | ||
run: cargo install cbindgen | ||
|
||
- name: Cache Rust dependencies | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: ${{matrix.target}} | ||
|
||
- name: Install musl for mac -> linux cross compilation | ||
if: ${{matrix.target == 'aarch64-unknown-linux-musl'}} | ||
run: brew install filosottile/musl-cross/musl-cross | ||
|
||
- name: Build library | ||
env: | ||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-gcc | ||
run: make TARGET=${{matrix.target}} release | ||
|
||
- name: Run C tests | ||
if: ${{matrix.os != 'windows-latest'}} | ||
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. Again … why is Windows disabled? See also lines 70 and 74. |
||
run: make TARGET=${{matrix.target}} test-c | ||
|
||
- name: Run C++ tests | ||
if: ${{matrix.os != 'windows-latest'}} | ||
run: make TARGET=${{matrix.target}} test-cpp | ||
|
||
- name: Show Windows warning | ||
if: ${{matrix.os == 'windows-latest'}} | ||
run: echo "::warning::C/C++ tests did NOT run in Windows" | ||
|
||
- name: Move files to main folder | ||
run: mv target/release/libc2pa_c* . | ||
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. This may not work on Windows. 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. IIRC Windows uses |
||
|
||
- name: Add files to archive | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: c2pa-c_${{matrix.target}}-${{ steps.sha.outputs.sha_short }}.zip | ||
path: | | ||
README.md | ||
include/** | ||
examples/** | ||
libc2pa_c* | ||
retention-days: 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/target | ||
/dist | ||
/include | ||
/Cargo.lock | ||
|
||
.vscode | ||
|
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.
Oh, that's clever. Might have to steal that one elsewhere …