Skip to content

Commit d801007

Browse files
author
Dave Kozma
authored
Merge pull request #7 from contentauth/ci-build
CI build setup
2 parents f255a1e + 8b12dbd commit d801007

File tree

3 files changed

+135
-45
lines changed

3 files changed

+135
-45
lines changed

.github/workflows/build.yml

Lines changed: 130 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,139 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
7+
tags:
8+
- "*"
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
813

914
jobs:
10-
build-nightly-only:
11-
name: Build nightly only
15+
linux:
1216
runs-on: ubuntu-latest
13-
container: quay.io/pypa/manylinux2014_x86_64
17+
strategy:
18+
matrix:
19+
target: [x86_64, aarch64]
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-python@v4
23+
with:
24+
python-version: "3.10"
25+
cache: "pip"
26+
- run: pip install -r requirements.txt
27+
- name: Setup QEMU
28+
uses: docker/setup-qemu-action@v1
29+
if: ${{ matrix.target == 'aarch64' }}
30+
- name: Build wheels
31+
uses: PyO3/maturin-action@v1
32+
with:
33+
target: ${{ matrix.target }}
34+
maturin-version: "1.2.0"
35+
args: --release --out dist --find-interpreter
36+
sccache: "true"
37+
manylinux: ${{ matrix.target == 'aarch64' && 'manylinux_2_28' || 'auto' }}
38+
before-script-linux: "pip install uniffi-bindgen==0.24.1"
39+
- name: Upload wheels
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: wheels
43+
path: dist
44+
45+
windows:
46+
runs-on: windows-latest
47+
strategy:
48+
matrix:
49+
target: [x64, x86]
50+
steps:
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-python@v4
53+
with:
54+
python-version: '3.10'
55+
architecture: ${{ matrix.target }}
56+
cache: "pip"
57+
- run: pip install -r requirements.txt
58+
- name: Build wheels
59+
uses: PyO3/maturin-action@v1
60+
with:
61+
target: ${{ matrix.target }}
62+
args: --release --out dist --find-interpreter
63+
sccache: 'true'
64+
- name: Upload wheels
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: wheels
68+
path: dist
69+
70+
macos_x86:
71+
runs-on: macos-latest
1472
steps:
15-
- uses: actions/checkout@v1
16-
- name: Install nightly rust
17-
run: curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
18-
# Insert steps here to install you other dependencies. Note that you're running inside of cent os 7, not ubuntu
19-
- name: Installing custom dependency
20-
run: echo "Installing custom dependency"
21-
- name: Build
22-
run: |
23-
source $HOME/.cargo/env
24-
for PYBIN in /opt/python/cp3[6789]*/bin; do
25-
"${PYBIN}/pip" install maturin
26-
"${PYBIN}/maturin" build -m nightly-only/Cargo.toml -i "${PYBIN}/python" --release --manylinux 2014
27-
done
28-
# Auditwheel isn't generally necessary. This is only shown as refernce for cases where you link
29-
# external libraries, in which case you have to set manylinux to off and then use auditwheel repair
30-
- name: Auditwheel repair
31-
run: |
32-
for wheel in nightly-only/target/wheels/*.whl; do
33-
auditwheel repair "${wheel}"
34-
done
35-
36-
37-
# This is similar to the above, except we're only using the lowest supported python version to build a single
38-
# abi3 wheel
39-
build-nightly-only-abi3:
40-
name: Build nightly only abi3
73+
- uses: actions/checkout@v3
74+
- uses: actions/setup-python@v4
75+
with:
76+
python-version: '3.10'
77+
cache: "pip"
78+
- run: pip install -r requirements.txt
79+
- name: Build wheels
80+
uses: PyO3/maturin-action@v1
81+
with:
82+
target: x86_64
83+
args: --release --out dist --find-interpreter
84+
sccache: 'true'
85+
- name: Upload wheels
86+
uses: actions/upload-artifact@v3
87+
with:
88+
name: wheels
89+
path: dist
90+
91+
macos_aarch64:
92+
runs-on: macos-latest-large
93+
steps:
94+
- uses: actions/checkout@v3
95+
- uses: actions/setup-python@v4
96+
with:
97+
python-version: '3.10'
98+
cache: "pip"
99+
- run: pip install -r requirements.txt
100+
- name: Build wheels
101+
uses: PyO3/maturin-action@v1
102+
with:
103+
target: aarch64
104+
args: --release --out dist --find-interpreter
105+
sccache: 'true'
106+
- name: Upload wheels
107+
uses: actions/upload-artifact@v3
108+
with:
109+
name: wheels
110+
path: dist
111+
112+
sdist:
41113
runs-on: ubuntu-latest
42-
container: quay.io/pypa/manylinux2014_x86_64
43114
steps:
44-
- uses: actions/checkout@v1
45-
- name: Install nightly rust
46-
run: curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
47-
- name: Install maturin
48-
run: /opt/python/cp36-cp36m/bin/pip install maturin
49-
- name: Build with maturin
50-
run: |
51-
source $HOME/.cargo/env
52-
/opt/python/cp36-cp36m/bin/maturin build -m nightly-only-abi3/Cargo.toml -i /opt/python/cp36-cp36m/bin/python --release --manylinux 2014
53-
- name: Auditwheel repair
54-
run: auditwheel repair nightly-only-abi3/target/wheels/*.whl
115+
- uses: actions/checkout@v3
116+
- name: Build sdist
117+
uses: PyO3/maturin-action@v1
118+
with:
119+
command: sdist
120+
args: --out dist
121+
- name: Upload sdist
122+
uses: actions/upload-artifact@v3
123+
with:
124+
name: wheels
125+
path: dist
126+
127+
# release:
128+
# name: Release
129+
# runs-on: ubuntu-latest
130+
# if: "startsWith(github.ref, 'refs/tags/')"
131+
# needs: [linux, windows, macos, sdist]
132+
# steps:
133+
# - uses: actions/download-artifact@v3
134+
# with:
135+
# name: wheels
136+
# - name: Publish to PyPI
137+
# uses: PyO3/maturin-action@v1
138+
# env:
139+
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
140+
# with:
141+
# command: upload
142+
# args: --non-interactive --skip-existing *

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ name = "c2pa"
1010
crate-type = ["cdylib"]
1111

1212
[dependencies]
13-
c2pa-c = { git = "https://github.com/contentauth/c2pa-c.git", branch = "main"}
13+
c2pa-c = { git = "https://github.com/contentauth/c2pa-c.git", branch = "main" }
1414
serde = { version = "1.0", features = ["derive"] }
1515
serde_derive = "1.0"
1616
serde_json = "1.0"
17-
thiserror = "1.0.49"
18-
uniffi = "0.24.3"
17+
thiserror = "1.0.49"
18+
uniffi = "0.24.1"
1919

2020
[build-dependencies]
2121
uniffi = { version = "0.24.1", features = ["build"] }

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
maturin==1.2.0
2+
uniffi-bindgen==0.24.1

0 commit comments

Comments
 (0)