diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40680fe..d72104a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,17 +6,19 @@ name: main jobs: test: - runs-on: ubuntu-latest strategy: fail-fast: false matrix: rust: - # Don't pull in newest dependencies when using old Rust toolchain - - version: 1.70.0 + - version: 1.70.0 # MSRV env: SKIP_CARGO_UPDATE=1 - version: stable - version: beta - version: nightly + os: + - ubuntu-latest + - windows-latest + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 82ba6bc..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,37 +0,0 @@ -image: Visual Studio 2022 - -environment: - global: - PROJECT_NAME: capstone-rs - matrix: - # Stable channel - - TARGET: i686-pc-windows-gnu - CHANNEL: stable - - TARGET: i686-pc-windows-msvc - CHANNEL: stable - - TARGET: x86_64-pc-windows-gnu - CHANNEL: stable - - TARGET: x86_64-pc-windows-msvc - CHANNEL: stable - -# Install Rust and Cargo -# (Based on from https://github.com/rust-lang/libc/blob/d03a1ff2dc55044f4ac919c2673608d65791efbe/appveyor.yml) -install: - - if "%TARGET%" == "i686-pc-windows-gnu" set PATH=C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin;%PATH% - - if "%TARGET%" == "x86_64-pc-windows-gnu" set PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH% - - curl -sSf -o rustup-init.exe https://win.rustup.rs - - rustup-init.exe --default-host %TARGET% --default-toolchain %CHANNEL% -y - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -Vv - - cargo -Vv - -# 'cargo test' takes care of building for us, so disable Appveyor's build stage. This prevents -# the "directory does not contain a project or solution file" error. -# source: https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml#L113 -build: false - -# Equivalent to Travis' `script` phase -test_script: - - cd capstone-rs - - cargo build -v - - cargo test -v diff --git a/capstone-rs/ci/test.sh b/capstone-rs/ci/test.sh index c90a625..7fe647f 100755 --- a/capstone-rs/ci/test.sh +++ b/capstone-rs/ci/test.sh @@ -34,6 +34,7 @@ export RUST_BACKTRACE=1 SHOULD_FAIL=${SHOULD_FAIL:-} # Default to false VALGRIND_TESTS=${VALGRIND_TESTS:-} CARGO="${CARGO:-cargo}" +UNAME="$(uname)" # Feature vars if [ -n "${ALL_FEATURES:-}" ] && [ -n "${NO_DEFAULT_FEATURES:-}" ]; then @@ -66,13 +67,21 @@ echo "Running as USER=$USER" echo "Test should $EXPECTED_RESULT" if ! [ "${OS_NAME:-}" ]; then - case "$(uname)" in + case "${UNAME}" in + CYGWIN*|MINGW*|MSYS_NT*) OS_NAME=windows ;; Linux) OS_NAME=linux ;; Darwin) OS_NAME=osx ;; FreeBSD) OS_NAME=freebsd ;; esac fi +true_path() { + case "${OS_NAME}" in + windows) cygpath -m "$@" ;; + *) echo "$@" ;; + esac +} + # Usage: SHOULD_FAIL [ARG1 [ARG2 [...]]] expect_exit_status() { local SHOULD_FAIL="$1" @@ -216,7 +225,7 @@ test_rust_file() { tmp_dir="$(mktemp -d /tmp/rust.testdir.XXXXXXXXXX)" [ -d "$tmp_dir" ] || Error "Could not make temp dir" - capstone_dir="$(pwd)" + capstone_dir="$(true_path "$(pwd)")" cd "$tmp_dir" ${CARGO} new --bin test_project -v cd test_project @@ -293,8 +302,12 @@ run_tests() { cargo_update() { if [ -z "${SKIP_CARGO_UPDATE:-}" ]; then - echo "Updating dependencies in Cargo.lock" - ${CARGO} update + if [[ -n "${CI:-}" ]]; then + echo "Updating dependencies in Cargo.lock" + ${CARGO} update + else + echo "Skipping 'cargo update' since we are not in CI" + fi else echo "Skipping 'cargo update' since SKIP_CARGO_UPDATE is set" fi