Skip to content

Commit

Permalink
Merge branch 'main' into fix/C2PA-542/622/multipleDataHashExclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
brogdonm authored Mar 7, 2025
2 parents 1d76ce5 + 7bfc9b0 commit d5a2474
Show file tree
Hide file tree
Showing 134 changed files with 4,044 additions and 1,821 deletions.
236 changes: 236 additions & 0 deletions .github/workflows/beta-preflight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
# IMPORTANT: Run this manually shortly before a new Rust stable release
# is expected. This job should be kept the same as ci.yml, except for the
# following changes:
#
# * All instances of `stable` should be replaced with `beta`.
# * All jobs that require Rust `nightly` should be deleted.

name: Preflight with Rust beta

on:
workflow_dispatch:
push:
branches:
- beta-preflight

jobs:
tests:
name: Unit tests

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
rust_version: [beta]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
components: llvm-tools-preview

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Generate code coverage
env:
RUST_BACKTRACE: "1"
run: cargo llvm-cov --lib --all-features --lcov --output-path lcov.info

tests-cli:
name: Unit tests (c2patool)
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
rust_version: [beta]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
components: llvm-tools-preview

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Generate code coverage
env:
RUST_BACKTRACE: "1"
run: cargo llvm-cov --bins --all-features --lcov --output-path lcov.info

doc-tests:
name: Doc tests (requires nightly Rust)
# TODO: Remove this once cargo-llvm-cov can run doc tests and generate
# coverage. (This requires a bug fix that is only available in nightly Rust.)
# Watch https://github.com/taiki-e/cargo-llvm-cov/issues/2
# for progress.

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@beta
# - name: Install Rust toolchain
# uses: dtolnay/rust-toolchain@nightly
# with:
# components: llvm-tools-preview

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

# Disabling code coverage for doc tests due to a new bug in Rust nightly
# as of 2025-01-08. Will investigate later to see if there's a repro case.
# Meanwhile, simply run the tests so we know if there are any failing
# doc tests.

- name: Run doc tests (COVERAGE DISABLED)
run:
cargo test --workspace --all-features --doc

# - name: Generate code coverage
# env:
# RUST_BACKTRACE: "1"
# run: cargo llvm-cov --workspace --all-features --lcov --doctests --output-path lcov.info

# Tokens aren't available for PRs originating from forks,
# so we don't attempt to upload code coverage in that case.
# - name: Upload code coverage results
# if: |
# github.event_name != 'pull_request' ||
# github.event.pull_request.author_association == 'COLLABORATOR' ||
# github.event.pull_request.author_association == 'MEMBER' ||
# github.event.pull_request.user.login == 'dependabot[bot]'
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# verbose: true

cargo-check:
name: Default features build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@beta

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: "`cargo check` with default features"
run: cargo check

tests-cross:
name: Unit tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
target: [aarch64-unknown-linux-gnu]
rust_version: [beta]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
targets: ${{ matrix.target }}

- name: Install cross-compilation toolset
run: cargo install cross

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

# Note that we do not run code coverage because
# it isn't readily accessible from cross-compilation
# environment. (A PR to fix this would be welcomed!)

- name: Run unit tests (cross build)
run: cross test --all-targets --all-features --target ${{ matrix.target }}

tests-wasm:
name: Unit tests (WASM)
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@beta

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Run Wasm tests (c2pa-crypto)
run: wasm-pack test --chrome --headless
working-directory: ./internal/crypto

- name: Run Wasm tests (c2pa-status-tracker)
run: wasm-pack test --chrome --headless
working-directory: ./internal/status-tracker

- name: Run Wasm tests (c2pa-rs)
run: wasm-pack test --chrome --headless
working-directory: ./sdk

- name: Run Wasm tests (cawg-identity)
run: wasm-pack test --chrome --headless
working-directory: ./cawg_identity

clippy_check:
name: Clippy
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@beta
with:
components: clippy

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Run Clippy
run: cargo clippy --all-features --all-targets -- -Dwarnings
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,56 @@ jobs:
run: wasm-pack test --chrome --headless
working-directory: ./cawg_identity

tests-wasi:
name: Unit tests (WASI)
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.author_association == 'COLLABORATOR' ||
github.event.pull_request.author_association == 'MEMBER' ||
github.event.pull_request.user.login == 'dependabot[bot]' ||
contains(github.event.pull_request.labels.*.name, 'safe to test')
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

# nightly required for testing until this issue is resolved:
# wasip2 target should not conditionally feature gate stdlib APIs rust-lang/rust#130323 https://github.com/rust-lang/rust/issues/130323
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Install wasmtime
run: |
curl https://wasmtime.dev/install.sh -sSf | bash
echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH
- name: Install WASI SDK
run: |
if [ "${RUNNER_ARCH}" = "X64" ]; then
ARCH="x86_64";
else
ARCH="${RUNNER_ARCH}";
fi
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
tar xvf wasi-sdk-25.0-${ARCH}-${RUNNER_OS}.tar.gz
mv $(echo wasi-sdk-25.0-${ARCH}-${RUNNER_OS} | tr '[:upper:]' '[:lower:]') /opt/wasi-sdk
- name: Add wasm32-wasip2 target
run: rustup target add --toolchain nightly wasm32-wasip2

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

- name: Run WASI tests (c2pa-rs)
env:
CARGO_TARGET_WASM32_WASIP2_RUNNER: "wasmtime -S cli -S http --dir ."
CC: /opt/wasi-sdk/bin/clang
WASI_SDK_PATH: /opt/wasi-sdk
RUST_MIN_STACK: 16777216
run: cargo +nightly test --target wasm32-wasip2 -p c2pa -p c2pa-crypto -p cawg-identity -p c2patool --all-features

test-direct-minimal-versions:
name: Unit tests with minimum versions of direct dependencies
if: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/target/

**/*.rs.bk
**/*.tmp*

.DS_Store
.idea
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

Since version 0.36.2, the format of this changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.46.0](https://github.com/contentauth/c2pa-rs/compare/c2pa-v0.45.3...c2pa-v0.46.0)
_15 February 2025_

### Added

* Add support for DynamicAssertions in JSON format (#924)

### Fixed

* Panic in decoding of GIF chunks (#873)
* Use correct byte label for GIF Plain Text Extension (#864)
* Panic in slicing of empty XMP data (#872)

### Other

* Use `AsRef<Path>` in `jumbf_io` functions (#910)

## [0.45.3](https://github.com/contentauth/c2pa-rs/compare/c2pa-v0.45.2...c2pa-v0.45.3)
_11 February 2025_

### Fixed

* Restore support for claim_generator_hints (#915)

## [0.45.2](https://github.com/contentauth/c2pa-rs/compare/c2pa-v0.45.1...c2pa-v0.45.2)
_06 February 2025_

### Documented

* Fix reported errors for docs (#903)

### Fixed

* Update error reporting (#906)
* Repair cargo test (#898)

## [0.45.1](https://github.com/contentauth/c2pa-rs/compare/c2pa-v0.45.0...c2pa-v0.45.1)
_31 January 2025_

Expand Down
Loading

0 comments on commit d5a2474

Please sign in to comment.