Skip to content

Commit

Permalink
Merge pull request #5 from Decompollaborate/develop
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
AngheloAlf authored Dec 22, 2023
2 parents c34389b + 490f440 commit 59e69bb
Show file tree
Hide file tree
Showing 59 changed files with 3,270 additions and 436 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/c_bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: C bindings

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
test-c-bindings:
name: Test C bindings
runs-on: ubuntu-latest
strategy:
fail-fast: false

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

- name: Make C test programs
run: make -C bindings/c BUILD_MODE=release

- name: Test dummies
run: ./bindings/c/tests/test_checksum_dummies.sh

check_clippy_c_bindings:
name: Check clippy for C bindings
runs-on: ubuntu-latest

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

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Setup clippy
run: rustup component add clippy

- name: Run clippy
run: cargo clippy --all-targets --features c_bindings -- -D warnings

release:
name: Release ${{ matrix.crate-type }} for ${{ matrix.target }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
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]
crate-type: [staticlib]
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-pc-windows-msvc
archive: zip
- target: x86_64-apple-darwin
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz
- target: x86_64-unknown-linux-gnu
archive: tar.gz

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

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Build lib
run: cargo rustc --lib --features c_bindings --release --crate-type ${{ matrix.crate-type }} --target ${{ matrix.target }}

- name: Print built files
run: |
tree target/${{ matrix.target }}/release
- name: Move files for packaging
run: |
mkdir -p package/lib package/include
cp target/${{ matrix.target }}/release/libipl3checksum.a package/lib/ || cp target/${{ matrix.target }}/release/ipl3checksum.lib package/lib/
cp -r bindings/c/include/* package/include/
cp LICENSE package/ipl3checksum.LICENSE
cp README.md package/ipl3checksum.README.md
cp CHANGELOG.md package/ipl3checksum.CHANGELOG.md
tree package
- name: Package .tar.gz
if: matrix.archive == 'tar.gz'
run: |
cd package && tar -czf ../ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz *
- name: Package .zip
if: matrix.archive == 'zip'
run: |
cd package && zip -r ../ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.zip *
- name: Upload .tar.gz archive
if: matrix.archive == 'tar.gz'
uses: actions/upload-artifact@v3
with:
name: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}
path: |
ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz
if-no-files-found: error

- name: Upload .zip archive
if: matrix.archive == 'zip'
uses: actions/upload-artifact@v3
with:
name: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}
path: |
ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.zip
if-no-files-found: error

- name: Publish .tar.gz release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.archive == 'tar.gz'
with:
files: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.tar.gz

- name: Publish .zip release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.archive == 'zip'
with:
files: ipl3checksum-${{ matrix.crate-type }}-${{ matrix.target }}.zip
164 changes: 164 additions & 0 deletions .github/workflows/maturin_upload_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# This file is autogenerated by maturin v1.4.0
# To update, run
#
# maturin generate-ci github
#
name: Upload to PyPI

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Python
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
if-no-files-found: error

windows:
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Python
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
if-no-files-found: error

macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Python
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
if-no-files-found: error

sdist:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v4

- 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

check_clippy_python_bindings:
name: Check clippy for C bindings
runs-on: ubuntu-latest

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

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Setup clippy
run: rustup component add clippy

- name: Run clippy
run: cargo clippy --all-targets --features python_bindings -- -D warnings

release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [linux, windows, macos, sdist, check_clippy_python_bindings]
strategy:
fail-fast: false
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: wheels

- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.pypi_password }}
with:
command: upload
args: --non-interactive --skip-existing *
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Install Dependencies
run: |
pip3 install mypy -U
pip3 install -U mypy
- name: mypy
run: mypy --show-column-numbers --hide-error-context .
84 changes: 84 additions & 0 deletions .github/workflows/publish_crate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and upload Rust crate

# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]

jobs:
check_fmt:
name: Check format
runs-on: ubuntu-latest

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

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Check format
run: cargo fmt --check

check_clippy:
name: Check clippy
runs-on: ubuntu-latest

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

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Setup clippy
run: rustup component add clippy

- name: Run clippy
run: cargo clippy --all-targets -- -D warnings

run_tests:
name: Run tests
runs-on: ubuntu-latest

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

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Run tests
run: cargo test --workspace

publish:
name: Publish
runs-on: ubuntu-latest

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

- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build Rust package
run: cargo build --release --workspace

- name: Publish dry run
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')
run: cargo publish --dry-run

- name: Upload crate
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
Loading

0 comments on commit 59e69bb

Please sign in to comment.