Skip to content

Commit b85472d

Browse files
authored
Merge pull request #37 from scipopt/fix-docsrs
Use pregenerated bindings on Docs.rs
2 parents cda52bb + e9fe838 commit b85472d

3 files changed

Lines changed: 59072 additions & 4 deletions

File tree

.github/workflows/build_and_test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
os: [
1616
ubuntu-latest,
17-
macos-13,
17+
macos-15,
1818
macos-14, # macOS arm runner
1919
windows-latest,
2020
ubuntu-24.04-arm
@@ -33,7 +33,7 @@ jobs:
3333
# matrix:
3434
# os: [
3535
# ubuntu-latest,
36-
# macos-13,
36+
# macos-15,
3737
# macos-14, # macOS arm runner
3838
# windows-latest,
3939
# ]
@@ -50,7 +50,7 @@ jobs:
5050
strategy:
5151
matrix:
5252
os: [
53-
macos-13,
53+
macos-15,
5454
macos-14,
5555
ubuntu-latest,
5656
windows-latest,
@@ -59,7 +59,7 @@ jobs:
5959
steps:
6060
- uses: actions/checkout@v3
6161
- name: Install bison
62-
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-14' }}
62+
if: ${{ matrix.os == 'macos-15' || matrix.os == 'macos-14' }}
6363
run: |
6464
brew install bison gcc
6565
- name: Test from-source

build.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ fn try_system_include_paths() -> Option<bindgen::Builder> {
140140
}
141141

142142
fn main() -> Result<(), Box<dyn Error>> {
143+
// Detect docs.rs build environment (no network access)
144+
if env::var("DOCS_RS").is_ok() {
145+
println!("cargo:warning=Building on docs.rs, using pre-generated bindings");
146+
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
147+
std::fs::copy("src/bindings_pregenerated.rs", out_path.join("bindings.rs"))?;
148+
return Ok(());
149+
}
150+
143151
let builder = if is_bundled_feature_enabled() {
144152
download_scip();
145153
let path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("scip_install");

0 commit comments

Comments
 (0)