Skip to content

Commit

Permalink
ci: migrate windows ci to github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tmfink committed Apr 20, 2024
1 parent db1877f commit 8206549
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 44 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 0 additions & 37 deletions appveyor.yml

This file was deleted.

21 changes: 17 additions & 4 deletions capstone-rs/ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8206549

Please sign in to comment.