Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run export validation on macOS #1226

Merged
merged 6 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 9 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,6 @@ jobs:
env:
RUSTDOCFLAGS: -D warnings

export:
name: Validate 3MF Export
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up toolchain
uses: oxidecomputer/actions-rs_toolchain@oxide/master
# see https://github.com/actions-rs/toolchain/pull/209
# uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
target: ${{ matrix.target }}
- name: Set up Rust cache
uses: Swatinem/rust-cache@1232abb8968faf344409165de17cbf9e7f340fd8
- name: Run `export-validator`
uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b
with:
command: run
args: --package export-validator

test:
name: Test
strategy:
Expand Down Expand Up @@ -141,11 +119,18 @@ jobs:
with:
command: build
args: --all-features
# The repo shouldn't have any unstaged changes after a build
- name: Check up-to-date repo
- name: Reject uncommitted changes
run: git diff --exit-code
- name: Run `cargo test`
uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b
with:
command: test
args: --all-features
- name: Run `export-validator`
uses: actions-rs/cargo@4ff6ec2846f6e7217c1a9b0b503506665f134c4b
with:
command: run
args: --package export-validator
# Export Validator doesn't support Windows yet. Issue:
# https://github.com/hannobraun/Fornjot/issues/920
if: ${{ matrix.os != 'windows-latest' }}
19 changes: 8 additions & 11 deletions tools/export-validator/build.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
use std::env;
use std::{env, path::PathBuf};

fn main() -> anyhow::Result<()> {
let manifest_dir = env::var("CARGO_MANIFEST_DIR")?;

let libs_dir_relative = "lib3mf/libs";
let libs_dir = format!("{manifest_dir}/{libs_dir_relative}");
let mut libs_dir = PathBuf::from(manifest_dir);
libs_dir.push("lib3mf");
libs_dir.push("libs");

// This is necessary to link against the dynamic library.
println!("cargo:rustc-link-search=native={libs_dir}");
println!("cargo:rustc-link-search=native={}", libs_dir.display());
println!("cargo:rustc-link-lib=dylib=3mf");

// And this is necessary, so the linked library is found at runtime.
//
// The relative path used here is designed to work when the validator is
// executed within the repository using `cargo run`, which is the intended
// use case.
let executable_to_libs =
format!("../../tools/export-validator/{libs_dir_relative}");
println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN/{executable_to_libs}");
if cfg!(target_family = "unix") {
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libs_dir.display());
}

Ok(())
}
Binary file not shown.
1 change: 1 addition & 0 deletions tools/export-validator/lib3mf/libs/lib3mf.dylib