From 3b673323f6eed3b5d53d5fef1e2a6e3c4da43682 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:08:29 -0500 Subject: [PATCH 01/16] Add CI build GitHub Actions workflow --- .github/workflows/build.yml | 54 ---------------- .github/workflows/ci.yml | 121 ++++++++++++++++++++++++++++++++++++ Cargo.toml | 6 +- 3 files changed, 124 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 84c47a14..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Build - -on: - push: - branches: - - main - pull_request: - -jobs: - build-nightly-only: - name: Build nightly only - runs-on: ubuntu-latest - container: quay.io/pypa/manylinux2014_x86_64 - steps: - - uses: actions/checkout@v1 - - name: Install nightly rust - run: curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly - # Insert steps here to install you other dependencies. Note that you're running inside of cent os 7, not ubuntu - - name: Installing custom dependency - run: echo "Installing custom dependency" - - name: Build - run: | - source $HOME/.cargo/env - for PYBIN in /opt/python/cp3[6789]*/bin; do - "${PYBIN}/pip" install maturin - "${PYBIN}/maturin" build -m nightly-only/Cargo.toml -i "${PYBIN}/python" --release --manylinux 2014 - done - # Auditwheel isn't generally necessary. This is only shown as refernce for cases where you link - # external libraries, in which case you have to set manylinux to off and then use auditwheel repair - - name: Auditwheel repair - run: | - for wheel in nightly-only/target/wheels/*.whl; do - auditwheel repair "${wheel}" - done - - - # This is similar to the above, except we're only using the lowest supported python version to build a single - # abi3 wheel - build-nightly-only-abi3: - name: Build nightly only abi3 - runs-on: ubuntu-latest - container: quay.io/pypa/manylinux2014_x86_64 - steps: - - uses: actions/checkout@v1 - - name: Install nightly rust - run: curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly - - name: Install maturin - run: /opt/python/cp36-cp36m/bin/pip install maturin - - name: Build with maturin - run: | - source $HOME/.cargo/env - /opt/python/cp36-cp36m/bin/maturin build -m nightly-only-abi3/Cargo.toml -i /opt/python/cp36-cp36m/bin/python --release --manylinux 2014 - - name: Auditwheel repair - run: auditwheel repair nightly-only-abi3/target/wheels/*.whl \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..ce6e9ad5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,121 @@ +# This file is autogenerated by maturin v1.4.0 +# To update, run +# +# maturin generate-ci github +# +name: CI + +on: + push: + branches: + - main + - ci-build + tags: + - "*" + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64, aarch64] + # target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: "true" + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + # windows: + # runs-on: windows-latest + # strategy: + # matrix: + # target: [x64, x86] + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.10' + # architecture: ${{ matrix.target }} + # - name: Build wheels + # uses: PyO3/maturin-action@v1 + # with: + # target: ${{ matrix.target }} + # args: --release --out dist --find-interpreter + # sccache: 'true' + # - name: Upload wheels + # uses: actions/upload-artifact@v3 + # with: + # name: wheels + # path: dist + + # macos: + # runs-on: macos-latest + # strategy: + # matrix: + # target: [x86_64, aarch64] + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-python@v4 + # with: + # python-version: '3.10' + # - name: Build wheels + # uses: PyO3/maturin-action@v1 + # with: + # target: ${{ matrix.target }} + # args: --release --out dist --find-interpreter + # sccache: 'true' + # - name: Upload wheels + # uses: actions/upload-artifact@v3 + # with: + # name: wheels + # path: dist + + # sdist: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - name: Build sdist + # uses: PyO3/maturin-action@v1 + # with: + # command: sdist + # args: --out dist + # - name: Upload sdist + # uses: actions/upload-artifact@v3 + # with: + # name: wheels + # path: dist + + # release: + # name: Release + # runs-on: ubuntu-latest + # if: "startsWith(github.ref, 'refs/tags/')" + # needs: [linux, windows, macos, sdist] + # steps: + # - uses: actions/download-artifact@v3 + # with: + # name: wheels + # - name: Publish to PyPI + # uses: PyO3/maturin-action@v1 + # env: + # MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + # with: + # command: upload + # args: --non-interactive --skip-existing * diff --git a/Cargo.toml b/Cargo.toml index a9831a19..120a36ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,12 +10,12 @@ name = "c2pa" crate-type = ["cdylib"] [dependencies] -c2pa-c = { git = "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/contentauth/c2pa-c.git", branch = "main"} +c2pa-c = { git = "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/contentauth/c2pa-c.git", branch = "main" } serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" -thiserror = "1.0.49" -uniffi = "0.24.3" +thiserror = "1.0.49" +uniffi = "0.24.1" [build-dependencies] uniffi = { version = "0.24.1", features = ["build"] } From 1477f0b6107a4f8f691fbb35264ddc409a405a29 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:10:14 -0500 Subject: [PATCH 02/16] Pin maturin version --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce6e9ad5..0c33c5eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - target: [x86_64, aarch64] # target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + target: [x86_64] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -34,6 +34,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} + maturin-version: "1.2.0" args: --release --out dist --find-interpreter sccache: "true" manylinux: auto From a6a52e53d7629e14f0864e9586d03b932eae9958 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:16:26 -0500 Subject: [PATCH 03/16] Try with maturin 1.4.0 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c33c5eb..f235beaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - maturin-version: "1.2.0" + maturin-version: "1.4.0" args: --release --out dist --find-interpreter sccache: "true" manylinux: auto From 82e93759a8b01a4415d55977e1c8071b89abd26d Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:21:08 -0500 Subject: [PATCH 04/16] Add requirements.txt --- .github/workflows/ci.yml | 2 ++ requirements.txt | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f235beaa..7a2e3352 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: - uses: actions/setup-python@v4 with: python-version: "3.10" + cache: "pip" + - run: pip install -r requirements.txt - name: Build wheels uses: PyO3/maturin-action@v1 with: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..e7df30ef --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +maturin==1.2.0 +uniffi-bindgen==0.24.1 \ No newline at end of file From 083cc1a52c46f6a7ca155538f12642d6de23e8d4 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:31:51 -0500 Subject: [PATCH 05/16] Add before script --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a2e3352..2e2ef3f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,10 +36,11 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - maturin-version: "1.4.0" + maturin-version: "1.2.0" args: --release --out dist --find-interpreter sccache: "true" manylinux: auto + before-script-linux: "pip install uniffi-bindgen==0.24.1" - name: Upload wheels uses: actions/upload-artifact@v3 with: From d6a25169545369e5dd96a5b175588604f06d3a50 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:44:27 -0500 Subject: [PATCH 06/16] Add QEMU --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e2ef3f0..692ac874 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: strategy: matrix: # target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] - target: [x86_64] + target: [x86_64, aarch64] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -32,6 +32,8 @@ jobs: python-version: "3.10" cache: "pip" - run: pip install -r requirements.txt + - name: Setup QEMU + uses: docker/setup-qemu-action@v1 - name: Build wheels uses: PyO3/maturin-action@v1 with: From 42e0b038aec5e7ca8916ac8168a23f0785afa55a Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:50:13 -0500 Subject: [PATCH 07/16] Update manylinux to 2_28 to get around ring not cross-compiling --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 692ac874..eca59f9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: maturin-version: "1.2.0" args: --release --out dist --find-interpreter sccache: "true" - manylinux: auto + manylinux: "2_28" before-script-linux: "pip install uniffi-bindgen==0.24.1" - name: Upload wheels uses: actions/upload-artifact@v3 From ad8b2aa823779a979dbd447eb7d335a20b529624 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 18:56:22 -0500 Subject: [PATCH 08/16] Add correct tag --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eca59f9f..af9998ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: maturin-version: "1.2.0" args: --release --out dist --find-interpreter sccache: "true" - manylinux: "2_28" + manylinux: "manylinux_2_28" before-script-linux: "pip install uniffi-bindgen==0.24.1" - name: Upload wheels uses: actions/upload-artifact@v3 From 90710a635d76f89e1a7f5d83fbf4f10e6a1cd9a1 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 19:06:18 -0500 Subject: [PATCH 09/16] Only use QEMU for aarch64 matrix target --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af9998ac..399ceaee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,7 @@ jobs: - run: pip install -r requirements.txt - name: Setup QEMU uses: docker/setup-qemu-action@v1 + if: ${{ matrix.target == 'aarch64' }} - name: Build wheels uses: PyO3/maturin-action@v1 with: From db36a08426b810b95c9cbb92b79cf254b0026a47 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Fri, 19 Jan 2024 19:09:56 -0500 Subject: [PATCH 10/16] Auto manylinux for x86 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 399ceaee..66d8572e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: maturin-version: "1.2.0" args: --release --out dist --find-interpreter sccache: "true" - manylinux: "manylinux_2_28" + manylinux: ${{ matrix.target == 'aarch64' && 'manylinux_2_28' || 'auto' }} before-script-linux: "pip install uniffi-bindgen==0.24.1" - name: Upload wheels uses: actions/upload-artifact@v3 From 6b81026d2286ea29790efb43743ceea182e2fec2 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Mon, 22 Jan 2024 10:28:34 -0500 Subject: [PATCH 11/16] Update ci.yml --- .github/workflows/ci.yml | 75 +++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66d8572e..b68b7a29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,42 +73,47 @@ jobs: # name: wheels # path: dist - # macos: - # runs-on: macos-latest - # strategy: - # matrix: - # target: [x86_64, aarch64] - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-python@v4 - # with: - # python-version: '3.10' - # - name: Build wheels - # uses: PyO3/maturin-action@v1 - # with: - # target: ${{ matrix.target }} - # args: --release --out dist --find-interpreter - # sccache: 'true' - # - name: Upload wheels - # uses: actions/upload-artifact@v3 - # with: - # name: wheels - # path: dist + macos: + runs-on: macos-latest + strategy: + matrix: + target: [x86_64, aarch64] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: "pip" + - run: pip install -r requirements.txt + - name: Setup QEMU + uses: docker/setup-qemu-action@v1 + if: ${{ matrix.target == 'aarch64' }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist - # sdist: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Build sdist - # uses: PyO3/maturin-action@v1 - # with: - # command: sdist - # args: --out dist - # - name: Upload sdist - # uses: actions/upload-artifact@v3 - # with: - # name: wheels - # path: dist + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist # release: # name: Release From 5f17f81ecc7fc5622720f990e73d2c20527d0aab Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Mon, 22 Jan 2024 10:29:25 -0500 Subject: [PATCH 12/16] Remove ci-build actions --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b68b7a29..d15251fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,6 @@ on: push: branches: - main - - ci-build tags: - "*" pull_request: From 99a6093ee2fdc318dbb121a0b7fc5e0108430446 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Mon, 22 Jan 2024 10:34:13 -0500 Subject: [PATCH 13/16] Add native mac silicon runner --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d15251fb..067295f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,11 +72,8 @@ jobs: # name: wheels # path: dist - macos: + macos_x86: runs-on: macos-latest - strategy: - matrix: - target: [x86_64, aarch64] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -84,13 +81,31 @@ jobs: python-version: '3.10' cache: "pip" - run: pip install -r requirements.txt - - name: Setup QEMU - uses: docker/setup-qemu-action@v1 - if: ${{ matrix.target == 'aarch64' }} - name: Build wheels uses: PyO3/maturin-action@v1 with: - target: ${{ matrix.target }} + target: x86_64 + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + macos_aarch64: + runs-on: macos-latest-large + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: "pip" + - run: pip install -r requirements.txt + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: aarch64 args: --release --out dist --find-interpreter sccache: 'true' - name: Upload wheels From 0ae698c344b96c8f4726da6f9ebe26eab564a590 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Mon, 22 Jan 2024 10:42:44 -0500 Subject: [PATCH 14/16] Add Windows build, remove maturin message Removed the maturin message so that people don't blindly replace it and lose the custom changes. --- .github/workflows/ci.yml | 49 ++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 067295f6..d1b63eaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,3 @@ -# This file is autogenerated by maturin v1.4.0 -# To update, run -# -# maturin generate-ci github -# name: CI on: @@ -49,28 +44,28 @@ jobs: name: wheels path: dist - # windows: - # runs-on: windows-latest - # strategy: - # matrix: - # target: [x64, x86] - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-python@v4 - # with: - # python-version: '3.10' - # architecture: ${{ matrix.target }} - # - name: Build wheels - # uses: PyO3/maturin-action@v1 - # with: - # target: ${{ matrix.target }} - # args: --release --out dist --find-interpreter - # sccache: 'true' - # - name: Upload wheels - # uses: actions/upload-artifact@v3 - # with: - # name: wheels - # path: dist + windows: + runs-on: windows-latest + strategy: + matrix: + target: [x64, x86] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + architecture: ${{ matrix.target }} + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist macos_x86: runs-on: macos-latest From 7d4ff95a79e78c624286cb5a17afa1ebb95f36bd Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Mon, 22 Jan 2024 11:00:30 -0500 Subject: [PATCH 15/16] Update ci.yml --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1b63eaf..679d2e89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,8 @@ jobs: with: python-version: '3.10' architecture: ${{ matrix.target }} + cache: "pip" + - run: pip install -r requirements.txt - name: Build wheels uses: PyO3/maturin-action@v1 with: From 8b12dbdfa37f085eded36d215767fdba4d288aa2 Mon Sep 17 00:00:00 2001 From: Dave Kozma Date: Mon, 22 Jan 2024 13:37:40 -0500 Subject: [PATCH 16/16] Make builds only on merge to main / tagging --- .github/workflows/{ci.yml => build.yml} | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) rename .github/workflows/{ci.yml => build.yml} (97%) diff --git a/.github/workflows/ci.yml b/.github/workflows/build.yml similarity index 97% rename from .github/workflows/ci.yml rename to .github/workflows/build.yml index 679d2e89..d9c3eba5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: CI +name: Build on: push: @@ -6,7 +6,6 @@ on: - main tags: - "*" - pull_request: workflow_dispatch: permissions: @@ -17,7 +16,6 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - # target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] target: [x86_64, aarch64] steps: - uses: actions/checkout@v3