Skip to content

Commit 59e69bb

Browse files
authored
Merge pull request #5 from Decompollaborate/develop
1.1.0
2 parents c34389b + 490f440 commit 59e69bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3270
-436
lines changed

.github/workflows/c_bindings.yml

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: C bindings
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
test-c-bindings:
10+
name: Test C bindings
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
- name: Make C test programs
20+
run: make -C bindings/c BUILD_MODE=release
21+
22+
- name: Test dummies
23+
run: ./bindings/c/tests/test_checksum_dummies.sh
24+
25+
check_clippy_c_bindings:
26+
name: Check clippy for C bindings
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout reposistory
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Rust toolchain
34+
uses: actions-rs/toolchain@v1
35+
with:
36+
toolchain: stable
37+
override: true
38+
39+
- name: Setup clippy
40+
run: rustup component add clippy
41+
42+
- name: Run clippy
43+
run: cargo clippy --all-targets --features c_bindings -- -D warnings
44+
45+
release:
46+
name: Release ${{ matrix.crate-type }} for ${{ matrix.target }}
47+
runs-on: ubuntu-20.04
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
target: [x86_64-pc-windows-gnu, x86_64-pc-windows-msvc, x86_64-apple-darwin, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu]
52+
crate-type: [staticlib]
53+
include:
54+
- target: x86_64-pc-windows-gnu
55+
archive: zip
56+
- target: x86_64-pc-windows-msvc
57+
archive: zip
58+
- target: x86_64-apple-darwin
59+
archive: zip
60+
- target: x86_64-unknown-linux-musl
61+
archive: tar.gz
62+
- target: x86_64-unknown-linux-gnu
63+
archive: tar.gz
64+
65+
steps:
66+
- name: Checkout repo
67+
uses: actions/checkout@v4
68+
69+
- name: Setup Rust toolchain
70+
uses: dtolnay/rust-toolchain@stable
71+
with:
72+
targets: ${{ matrix.target }}
73+
74+
- name: Build lib
75+
run: cargo rustc --lib --features c_bindings --release --crate-type ${{ matrix.crate-type }} --target ${{ matrix.target }}
76+
77+
- name: Print built files
78+
run: |
79+
tree target/${{ matrix.target }}/release
80+
81+
- name: Move files for packaging
82+
run: |
83+
mkdir -p package/lib package/include
84+
cp target/${{ matrix.target }}/release/libipl3checksum.a package/lib/ || cp target/${{ matrix.target }}/release/ipl3checksum.lib package/lib/
85+
cp -r bindings/c/include/* package/include/
86+
cp LICENSE package/ipl3checksum.LICENSE
87+
cp README.md package/ipl3checksum.README.md
88+
cp CHANGELOG.md package/ipl3checksum.CHANGELOG.md
89+
tree package
90+
91+
- name: Package .tar.gz
92+
if: matrix.archive == 'tar.gz'
93+
run: |
94+
cd package && tar -czf ../ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz *
95+
96+
- name: Package .zip
97+
if: matrix.archive == 'zip'
98+
run: |
99+
cd package && zip -r ../ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.zip *
100+
101+
- name: Upload .tar.gz archive
102+
if: matrix.archive == 'tar.gz'
103+
uses: actions/upload-artifact@v3
104+
with:
105+
name: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}
106+
path: |
107+
ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz
108+
if-no-files-found: error
109+
110+
- name: Upload .zip archive
111+
if: matrix.archive == 'zip'
112+
uses: actions/upload-artifact@v3
113+
with:
114+
name: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}
115+
path: |
116+
ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.zip
117+
if-no-files-found: error
118+
119+
- name: Publish .tar.gz release
120+
uses: softprops/action-gh-release@v1
121+
if: startsWith(github.ref, 'refs/tags/') && matrix.archive == 'tar.gz'
122+
with:
123+
files: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz
124+
125+
- name: Publish .zip release
126+
uses: softprops/action-gh-release@v1
127+
if: startsWith(github.ref, 'refs/tags/') && matrix.archive == 'zip'
128+
with:
129+
files: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.zip
+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# This file is autogenerated by maturin v1.4.0
2+
# To update, run
3+
#
4+
# maturin generate-ci github
5+
#
6+
name: Upload to PyPI
7+
8+
on:
9+
push:
10+
pull_request:
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
linux:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
22+
fail-fast: false
23+
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: '3.10'
31+
32+
- name: Build wheels
33+
uses: PyO3/maturin-action@v1
34+
with:
35+
target: ${{ matrix.target }}
36+
args: --release --out dist --find-interpreter
37+
sccache: 'true'
38+
manylinux: auto
39+
40+
- name: Upload wheels
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: wheels
44+
path: dist
45+
if-no-files-found: error
46+
47+
windows:
48+
runs-on: windows-latest
49+
strategy:
50+
matrix:
51+
target: [x64, x86]
52+
fail-fast: false
53+
steps:
54+
- name: Checkout repo
55+
uses: actions/checkout@v4
56+
57+
- name: Setup Python
58+
uses: actions/setup-python@v4
59+
with:
60+
python-version: '3.10'
61+
architecture: ${{ matrix.target }}
62+
63+
- name: Build wheels
64+
uses: PyO3/maturin-action@v1
65+
with:
66+
target: ${{ matrix.target }}
67+
args: --release --out dist --find-interpreter
68+
sccache: 'true'
69+
70+
- name: Upload wheels
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: wheels
74+
path: dist
75+
if-no-files-found: error
76+
77+
macos:
78+
runs-on: macos-latest
79+
strategy:
80+
matrix:
81+
target: [x86_64, aarch64]
82+
steps:
83+
- name: Checkout repo
84+
uses: actions/checkout@v4
85+
86+
- name: Setup Python
87+
uses: actions/setup-python@v4
88+
with:
89+
python-version: '3.10'
90+
91+
- name: Build wheels
92+
uses: PyO3/maturin-action@v1
93+
with:
94+
target: ${{ matrix.target }}
95+
args: --release --out dist --find-interpreter
96+
sccache: 'true'
97+
98+
- name: Upload wheels
99+
uses: actions/upload-artifact@v3
100+
with:
101+
name: wheels
102+
path: dist
103+
if-no-files-found: error
104+
105+
sdist:
106+
runs-on: ubuntu-latest
107+
strategy:
108+
fail-fast: false
109+
steps:
110+
- name: Checkout repo
111+
uses: actions/checkout@v4
112+
113+
- name: Build sdist
114+
uses: PyO3/maturin-action@v1
115+
with:
116+
command: sdist
117+
args: --out dist
118+
119+
- name: Upload sdist
120+
uses: actions/upload-artifact@v3
121+
with:
122+
name: wheels
123+
path: dist
124+
125+
check_clippy_python_bindings:
126+
name: Check clippy for C bindings
127+
runs-on: ubuntu-latest
128+
129+
steps:
130+
- name: Checkout reposistory
131+
uses: actions/checkout@v4
132+
133+
- name: Setup Rust toolchain
134+
uses: actions-rs/toolchain@v1
135+
with:
136+
toolchain: stable
137+
override: true
138+
139+
- name: Setup clippy
140+
run: rustup component add clippy
141+
142+
- name: Run clippy
143+
run: cargo clippy --all-targets --features python_bindings -- -D warnings
144+
145+
release:
146+
name: Release
147+
runs-on: ubuntu-latest
148+
if: startsWith(github.ref, 'refs/tags/')
149+
needs: [linux, windows, macos, sdist, check_clippy_python_bindings]
150+
strategy:
151+
fail-fast: false
152+
steps:
153+
- name: Download artifact
154+
uses: actions/download-artifact@v3
155+
with:
156+
name: wheels
157+
158+
- name: Publish to PyPI
159+
uses: PyO3/maturin-action@v1
160+
env:
161+
MATURIN_PYPI_TOKEN: ${{ secrets.pypi_password }}
162+
with:
163+
command: upload
164+
args: --non-interactive --skip-existing *

.github/workflows/mypy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: Install Dependencies
2020
run: |
21-
pip3 install mypy -U
21+
pip3 install -U mypy
2222
2323
- name: mypy
2424
run: mypy --show-column-numbers --hide-error-context .

.github/workflows/publish_crate.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build and upload Rust crate
2+
3+
# Build on every branch push, tag push, and pull request change:
4+
on: [push, pull_request]
5+
6+
jobs:
7+
check_fmt:
8+
name: Check format
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout reposistory
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Rust toolchain
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
override: true
20+
21+
- name: Check format
22+
run: cargo fmt --check
23+
24+
check_clippy:
25+
name: Check clippy
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout reposistory
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Rust toolchain
33+
uses: actions-rs/toolchain@v1
34+
with:
35+
toolchain: stable
36+
override: true
37+
38+
- name: Setup clippy
39+
run: rustup component add clippy
40+
41+
- name: Run clippy
42+
run: cargo clippy --all-targets -- -D warnings
43+
44+
run_tests:
45+
name: Run tests
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- name: Checkout reposistory
50+
uses: actions/checkout@v4
51+
52+
- name: Setup Rust toolchain
53+
uses: actions-rs/toolchain@v1
54+
with:
55+
toolchain: stable
56+
override: true
57+
58+
- name: Run tests
59+
run: cargo test --workspace
60+
61+
publish:
62+
name: Publish
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Checkout reposistory
67+
uses: actions/checkout@v4
68+
69+
- name: Setup Rust toolchain
70+
uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: stable
73+
override: true
74+
75+
- name: Build Rust package
76+
run: cargo build --release --workspace
77+
78+
- name: Publish dry run
79+
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
80+
run: cargo publish --dry-run
81+
82+
- name: Upload crate
83+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
84+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)