Skip to content

Commit a706658

Browse files
gpeacockcdmurph32
andauthored
build: Integrates prebuilt library release workflow (#1126)
* chore: Updates c2pa_rs and leverages workspace versioning and dependencies * chore: repair capi_makefile - realpath was failing * chore: allow overwrite and add ssl env vars for win * chore(c_api): The artifacts did not have correct content * chore(c_api): fix the rpath and add universal debug symbols * chore(c_api): add powershell script for windows * build: add Maketext::Simple * build: cross comp fix * build: go back to stripping debug symbols until someone asks for them * build: Another shot at a linux arm build * build: use the right kind of perl * build: do not use make for windows build * build: use powershell for make on windows * build: c2pa_c libraries with native_rust_crypto * chore: repair make test moves some Reader functionality to Store store tests under v1_api until we resolve issues. Now that `json_api` has been removed the WASI test isn't as different. * fix: remove c2pa-c from ci job feature selection. All features are now named in c2pa crate. * build: fix the make release workflow --------- Co-authored-by: Colin Murphy <[email protected]>
1 parent b543622 commit a706658

File tree

24 files changed

+492
-294
lines changed

24 files changed

+492
-294
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
outputs:
2222
rust-native-features: ${{ steps.get-features.outputs.rust-native-features }}
2323
openssl-features: ${{ steps.get-features.outputs.openssl-features }}
24-
wasi-features: ${{ steps.get-features.outputs.wasi-features }}
2524
steps:
2625
- name: Checkout repository
2726
uses: actions/checkout@v4
@@ -34,13 +33,11 @@ jobs:
3433
- name: Get all features
3534
id: get-features
3635
run: |
37-
FEATURES=$(cargo metadata --format-version=1 | jq -r '[.packages[] | select(.name=="c2pa" or .name=="c2pa-c") | .features | keys | map(select(. != "default")) | .[]] | unique | join(" ")')
36+
FEATURES=$(cargo metadata --format-version=1 | jq -r '[.packages[] | select(.name=="c2pa") | .features | keys | map(select(. != "default")) | .[]] | unique | join(" ")')
3837
RUST_NATIVE_FEATURES=$(echo $FEATURES | sed 's/openssl//g')
3938
OPENSSL_FEATURES=$(echo $FEATURES | sed 's/rust_native_crypto//g')
40-
WASI_FEATURES=$(echo $RUST_NATIVE_FEATURES | sed 's/json_api//g')
4139
echo "rust-native-features=$RUST_NATIVE_FEATURES" >> "$GITHUB_OUTPUT"
4240
echo "openssl-features=$OPENSSL_FEATURES" >> "$GITHUB_OUTPUT"
43-
echo "wasi-features=$WASI_FEATURES" >> "$GITHUB_OUTPUT"
4441
4542
tests:
4643
name: Unit tests
@@ -379,7 +376,7 @@ jobs:
379376
CC: /opt/wasi-sdk/bin/clang
380377
WASI_SDK_PATH: /opt/wasi-sdk
381378
RUST_MIN_STACK: 16777216
382-
FEATURES: ${{needs.get-features.outputs.wasi-features}}
379+
FEATURES: ${{needs.get-features.outputs.rust-native-features}}
383380
run: |
384381
cargo +nightly-2025-05-14 test --target wasm32-wasip2 -p c2pa -p c2patool --features "$FEATURES" --no-default-features
385382

.github/workflows/library-release.yml

Lines changed: 27 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
tags:
66
- 'c2pa-v*' # Trigger on version tags (e.g., v1.0.0)
7-
workflow_dispatch: # Allow manual triggering of the workflow
7+
workflow_dispatch:
88

99
jobs:
1010
build:
@@ -13,16 +13,13 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: [ macos-latest, ubuntu-latest, windows-latest ]
17-
rust_version: [ stable ]
18-
experimental: [ false ]
1916
include:
2017
- os: macos-latest
2118
target: aarch64-apple-darwin
22-
19+
- os: ubuntu-latest
20+
target: aarch64-unknown-linux-gnu
2321
- os: ubuntu-latest
2422
target: x86_64-unknown-linux-gnu
25-
2623
- os: windows-latest
2724
target: x86_64-pc-windows-msvc
2825

@@ -33,84 +30,54 @@ jobs:
3330
- name: Set up Rust
3431
uses: actions-rust-lang/setup-rust-toolchain@v1
3532

36-
- name: Setup Strawberry Perl
37-
if: matrix.os == 'windows-latest'
38-
uses: shogo82148/actions-setup-perl@v1
39-
with:
40-
perl-version: '5.32'
41-
distribution: 'strawberry'
42-
43-
# Install Locale::Maketext::Simple only on Windows with explicit paths
44-
- name: Install Locale::Maketext::Simple and configure paths
33+
- name: Build Windows release
4534
if: matrix.os == 'windows-latest'
46-
run: |
47-
cpanm --verbose Locale::Maketext::Simple
48-
# List installed modules to confirm installation
49-
cpanm --info Locale::Maketext::Simple
50-
# Display Perl's include paths
51-
perl -e "print join(\"\n\", @INC);"
52-
# Create a local copy in the expected path
53-
perl -MLocale::Maketext::Simple -e "print \$INC{'Locale/Maketext/Simple.pm'}" > module_path.txt
54-
$MODULE_PATH = Get-Content -Path module_path.txt
55-
echo "Module found at: $MODULE_PATH"
56-
57-
# Create symbolic links to the modules in paths that are being checked
58-
# Set environment variable for subsequent steps
59-
echo "PERL5LIB=$env:PERL5LIB;D:\a\c2pa-rs\c2pa-rs\target\x86_64-pc-windows-msvc\release\build\openssl-sys-def693d178636927\out\openssl-build\build\src\util\perl" | Out-File -FilePath $env:GITHUB_ENV -Append
6035
shell: pwsh
61-
36+
run: |
37+
./setup-rust-openssl.ps1
6238
- name: Build release
39+
if: matrix.os != 'windows-latest'
6340
run: make release
6441

6542
- name: Upload build artifacts
6643
uses: actions/upload-artifact@v4
6744
with:
68-
name: ${{ matrix.os }}-${{ matrix.target }}-release
69-
path: target/artifacts/*
45+
name: release-artifacts-${{ matrix.os }}-${{ matrix.target }}
46+
path: target/artifacts/
7047

7148
release:
7249
needs: build
50+
if: always()
7351
runs-on: ubuntu-latest
7452
steps:
7553
- name: Download build artifacts
7654
uses: actions/download-artifact@v4
7755
with:
78-
path: artifacts
56+
pattern: release-artifacts-*
57+
path: .
58+
merge-multiple: true
7959

8060
- name: List downloaded artifacts
81-
run: find . -type f | sort
82-
61+
run: ls -lh
62+
63+
- name: Extract tag_name from zip file
64+
id: extract_tag
65+
run: |
66+
ZIP=$(ls c2pa-v*-*.zip | head -n1)
67+
TAG_NAME=$(echo "$ZIP" | sed -E 's/^(c2pa-v[0-9]+\.[0-9]+\.[0-9]+)-.*\.zip/\1/')
68+
echo "Found tag: $TAG_NAME"
69+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
70+
8371
- name: Create Release
8472
id: create_release
8573
uses: softprops/action-gh-release@v1
8674
with:
87-
files: |
88-
./ubuntu-latest-x86_64-unknown-linux-gnu-release/ubuntu-latest-x86_64-unknown-linux-gnu-release.tar.gz
89-
./windows-latest-x86_64-pc-windows-msvc-release/windows-latest-x86_64-pc-windows-msvc-release.zip
90-
./macos-latest-x86_64-apple-darwin-release/macos-latest-x86_64-apple-darwin-release.tar.gz
75+
tag_name: ${{ steps.extract_tag.outputs.tag_name }}
76+
77+
files: ./*
9178
draft: false
92-
prerelease: false
79+
prerelease: true
9380
generate_release_notes: true
94-
env:
95-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9681

97-
- name: Create GitHub Release legacy
98-
id: create_release_legacy
99-
uses: actions/create-release@v1
100-
env:
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102-
with:
103-
tag_name: ${{ github.ref_name }}
104-
release_name: Release ${{ github.ref_name }}
105-
draft: true
106-
prerelease: true
107-
108-
- name: Upload Release Assets old
10982
env:
11083
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111-
run: |
112-
for file in artifacts/*; do
113-
echo "Uploading $file..."
114-
gh release upload "${{ github.ref_name }}" "$file" --clobber
115-
done
116-

Cargo.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ members = [
99
"sdk",
1010
]
1111

12+
# members in this workspace can share this version setting
13+
[workspace.package]
14+
version = "0.51.1"
15+
16+
[workspace.dependencies]
17+
c2pa = { path = "sdk", default-features = false }
18+
1219
[profile.release]
1320
strip = true # Automatically strip symbols from the binary.
1421
opt-level = 3

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ ifeq ($(OS),Windows_NT)
55
PLATFORM := win
66
else
77
UNAME := $(shell uname)
8-
ifeq ($(UNAME),Linux)
9-
PLATFORM := linux
10-
endif
11-
ifeq ($(UNAME),Darwin)
12-
PLATFORM := mac
13-
endif
8+
ifeq ($(UNAME),Linux)
9+
PLATFORM := linux
10+
endif
11+
ifeq ($(UNAME),Darwin)
12+
PLATFORM := mac
13+
endif
1414
endif
1515

1616
check-format:
@@ -22,7 +22,7 @@ clippy:
2222
cargo clippy --features="file_io" --all-targets -- -D warnings
2323

2424
test-local:
25-
cargo test --features="file_io, fetch_remote_manifests, add_thumbnails" --all-targets
25+
cargo test --features="file_io, fetch_remote_manifests, add_thumbnails, v1_api" --all-targets
2626
# Builds and views documentation
2727

2828
test-wasm:

c_api/Cargo.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
[package]
2-
name = "c2pa-c"
3-
version = "0.49.5"
2+
name = "c_api"
3+
version.workspace = true
44
edition = "2021"
55
authors = ["Gavin Peacock <[email protected]>"]
66
license = "MIT OR Apache-2.0"
77

88
[lib]
9+
name = "c2pa_c"
910
crate-type = ["cdylib"]
1011

1112
[features]
12-
default = ["json_api", "openssl"]
13-
json_api = ["c2pa/v1_api"]
14-
openssl = ["c2pa/openssl"]
1513
rust_native_crypto = ["c2pa/rust_native_crypto"]
14+
file_io = ["c2pa/file_io"]
1615

1716
[dependencies]
1817
tokio = { version = "1.36", features = ["rt-multi-thread","rt"] }
19-
c2pa = { path = "../sdk", version = "0.53.0", features = [
18+
c2pa = { workspace = true , features = [
19+
2020
"file_io",
2121
"add_thumbnails",
2222
"fetch_remote_manifests",
23-
], default-features = false }
23+
]}
2424
scopeguard = "1.2.0"
2525
serde = { version = "1.0", features = ["derive"] }
2626
serde_json = "1.0"
@@ -32,3 +32,4 @@ tempfile = "3.7.0"
3232

3333
[build-dependencies]
3434
cbindgen = "0.28"
35+

0 commit comments

Comments
 (0)