Skip to content

Commit

Permalink
Merge branch 'main' into feat-batsat-solver
Browse files Browse the repository at this point in the history
  • Loading branch information
nfbruns authored Jun 14, 2024
2 parents 31d7e1c + ff1a3d6 commit cf6dd71
Show file tree
Hide file tree
Showing 157 changed files with 20,096 additions and 3,647 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
- [ ] I have added documentation for new features
- [ ] The test suite still passes on this PR
- [ ] I have added tests for new features / tests that would have caught the bug this PR fixes (please explain if not)
- [ ] If this PR contains breaking changes, it is against the [`next-major`](https://github.com/chrjabs/rustsat/tree/next-major) branch, not against [`main`](https://github.com/chrjabs/rustsat/tree/main)
1 change: 0 additions & 1 deletion .github/workflows/cadical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ jobs:
run: cargo test -p rustsat-cadical --verbose
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }}

56 changes: 56 additions & 0 deletions .github/workflows/capi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: C-API

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build-test:
name: Build and test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build-test"
- name: Cargo build
run: cargo build -p rustsat-capi --verbose
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }}
- name: Cargo test
run: cargo test -p rustsat-capi --verbose
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }}

version:
name: Ensure C-API crate version is in sync
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Check
run: "[ \"$(grep '^version = ' rustsat/Cargo.toml)\" = \"$(grep '^version = ' capi/Cargo.toml)\" ]"

cbindgen:
name: Test generated C header
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Check C header
run: |
cargo install cbindgen
cbindgen -c capi/cbindgen.toml --crate rustsat-capi -o capi/rustsat.h --verify
13 changes: 12 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
Expand All @@ -24,4 +26,13 @@ jobs:
- name: Check READMEs
run: |
cargo install cargo-rdme
for dir in rustsat tools cadical kissat minisat glucose ipasir; do cd ${dir} && (cargo rdme --check || echo "failed for ${dir}"); cd ..; done
return=true
for dir in rustsat tools cadical kissat minisat glucose ipasir capi pyapi; do
cd ${dir}
if ! cargo rdme --check; then
echo "failed for ${dir}"
return=false
fi
cd ..
done
${return}
2 changes: 2 additions & 0 deletions .github/workflows/glucose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/kissat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ jobs:
run: cargo test -p rustsat-kissat --verbose
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }}

2 changes: 2 additions & 0 deletions .github/workflows/minisat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
- name: Build Python package
uses: PyO3/maturin-action@v1
with:
args: -i python --manifest-path rustsat/Cargo.toml
args: -i python --manifest-path pyapi/Cargo.toml
- name: Install Python package
run: pip install target/wheels/rustsat*.whl
run: pip install --no-index --find-links target/wheels/ rustsat
- name: Build Python API docs
run: pip install pdoc && pdoc -o _site/pyapi/ rustsat
- name: Upload artifact
Expand Down
66 changes: 61 additions & 5 deletions .github/workflows/pyapi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is autogenerated by maturin v1.3.2
# To update, run
#
# maturin generate-ci -m rustsat/Cargo.toml github
# maturin generate-ci -m pyapi/Cargo.toml github
#
name: Python Build

Expand All @@ -19,6 +19,46 @@ permissions:
contents: read

jobs:
build-test:
name: Build and test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build-test"
- name: Cargo build
run: cargo build -p rustsat-pyapi --verbose
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }}
- name: Cargo test
run: cargo test -p rustsat-pyapi --verbose
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }}
- name: Build Python package
uses: PyO3/maturin-action@v1
with:
args: -i python --manifest-path pyapi/Cargo.toml
- name: Install Python package
run: pip install --no-index --find-links target/wheels/ rustsat
- name: Test PyAPI example
run: python pyapi/examples/pyapi-dpw.py

version:
name: Ensure Python API crate version is in sync
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Check
run: "[ \"$(grep '^version = ' rustsat/Cargo.toml)\" = \"$(grep '^version = ' pyapi/Cargo.toml)\" ]"

linux:
runs-on: ubuntu-latest
strategy:
Expand All @@ -33,7 +73,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --manifest-path rustsat/Cargo.toml
args: --release --out dist --manifest-path pyapi/Cargo.toml
sccache: 'true'
manylinux: auto
- name: Upload wheels
Expand All @@ -42,6 +82,22 @@ jobs:
name: wheels-linux-${{ matrix.target }}
path: dist

pystubs:
name: Test python stubs
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install maturin from PyPI
uses: install-pinned/maturin@0620ca40d2c575adaa48574fe2f6c76aa188e2c6
- name: Install mypy from PyPI
uses: install-pinned/mypy@cec260456eec5126750b72b8f0a6e6011eb85223
- name: Install python project
run: maturin build -m pyapi/Cargo.toml && pip install --no-index --find-links target/wheels/ rustsat
- name: Test stubs
run: stubtest --mypy-config-file pyapi/pyproject.toml --allowlist pyapi/stubtest-allowlist.txt rustsat

windows:
runs-on: windows-latest
strategy:
Expand All @@ -57,7 +113,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --manifest-path rustsat/Cargo.toml
args: --release --out dist --manifest-path pyapi/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand All @@ -79,7 +135,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --manifest-path rustsat/Cargo.toml
args: --release --out dist --manifest-path pyapi/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand All @@ -95,7 +151,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path rustsat/Cargo.toml
args: --out dist --manifest-path pyapi/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
submodules: "recursive"

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down
31 changes: 2 additions & 29 deletions .github/workflows/rustsat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
Expand All @@ -32,32 +34,3 @@ jobs:
run: cargo test -p rustsat --verbose --features=all
env:
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }}

pystubs:
name: Test python stubs
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install maturin from PyPI
uses: install-pinned/maturin@dfebcaa782a69944b584ec164e97fbbd09885352
- name: Install mypy from PyPI
uses: install-pinned/mypy@c2223951641cbb406fa8526d08f0690899f130e4
- name: Install python project
run: maturin build -m rustsat/Cargo.toml && pip install --no-index --find-links target/wheels/ rustsat
- name: Test stubs
run: stubtest --mypy-config-file rustsat/pyproject.toml --allowlist rustsat/stubtest-allowlist.txt rustsat

cbindgen:
name: Test generated C header
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Check C header
run: |
cargo install cbindgen
cbindgen -c rustsat/cbindgen.toml --crate rustsat -o rustsat/rustsat.h --verify
45 changes: 45 additions & 0 deletions .github/workflows/semver-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Semver checks

on:
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
rustsat:
name: Semver checks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: RustSAT
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
package: rustsat
feature-group: only-explicit-features
features: all
- name: CaDiCaL
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
package: rustsat-cadical
feature-group: default-features
- name: Minisat
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
package: rustsat-minisat
- name: Glucose
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
package: rustsat-glucose
- name: Kissat
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
package: rustsat-kissat
- name: IPASIR
uses: obi1kenobi/cargo-semver-checks-action@v2
with:
package: rustsat-ipasir
2 changes: 2 additions & 0 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

**/*.o
**/*.out
**/*.so

rustsat/pydocs/
**/__pycache__/
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "minisat/cppsrc"]
path = minisat/cppsrc
url = git@github.com:chrjabs/minisat.git
[submodule "glucose/cppsrc"]
path = glucose/cppsrc
url = git@github.com:chrjabs/glucose4.git
Loading

0 comments on commit cf6dd71

Please sign in to comment.