Skip to content
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
27 changes: 25 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,40 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
- os: macos-latest
- os: windows-latest
- os: windows-latest
target: x86_64-pc-windows-gnu
defaults:
run:
working-directory: rust
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- run: rustup target add ${{ matrix.target }}
if: matrix.target != ''
- run: echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
if: matrix.target != ''
- name: Upgrade MinGW package
# In https://github.com/bytecodealliance/wasmtime/pull/4003 we discovered that the ittapi C
# code uses the uncommon `strnlen_s` function. On older versions of MinGW (GitHub runners
# currently come with v8.1.0 pre-installed), this function was not available. Since v8.1.0,
# other versions have been published; this re-installs MinGW with a recent version which
# includes `strnlen_s`. This block can be removed if/when MinGW is upgraded in all Windows
# GitHub runners: https://github.com/actions/virtual-environments/issues/5530.
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
choco uninstall mingw
choco install mingw --version 11.2.0 --force
- name: Build Rust crate
run: cargo build
- name: Test Rust crate
run: cargo test
- name: Check crates are publishable
run: scripts/verify-publish.sh
# The Windows CI transforms the `c-library` symlink into a real directory, modifying the Git
# state, so we ignore these changes with `--allow-dirty` here.
run: scripts/verify-publish.sh --allow-dirty
2 changes: 1 addition & 1 deletion rust/ittapi-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Build the `ittapi` C library in the parent directory. The `cc` configuration here should match
//! that of the parent directories `CMakeLists.txt` (TODO: keep these in sync, see [#36]).
//! that of the parent directory's `CMakeLists.txt` (TODO: keep these in sync, see [#36]).
//!
//! [#36]: https://github.com/intel/ittapi/issues/36

Expand Down
6 changes: 4 additions & 2 deletions rust/scripts/verify-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Check that the Rust crates can all be packaged up for publication. This cannot use use `cargo
# publish --dry-run` because of the dependency between ittapi and ittapi-sys.
set -e

SCRIPT_ARGS=${@:1}
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
pushd $SCRIPT_DIR

Expand All @@ -19,13 +21,13 @@ directory = "vendor"
EOT

# Package up ittapi-sys and place it in the vendor directory.
cargo package --manifest-path ../ittapi-sys/Cargo.toml
cargo package --manifest-path ../ittapi-sys/Cargo.toml $SCRIPT_ARGS
pushd vendor
tar xf ../../target/package/ittapi-sys-0.*.crate
ITTAPI_SYS_DIR=$(echo ittapi-sys-0.*)
echo '{"files":{}}' > $ITTAPI_SYS_DIR/.cargo-checksum.json
popd

# Package up ittapi.
cargo package --manifest-path ../ittapi/Cargo.toml
cargo package --manifest-path ../ittapi/Cargo.toml $SCRIPT_ARGS
popd