diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..e87ef0ad --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,57 @@ +name: CI + +on: + push: + branches: + # test & v4 branches + - 'try-**' + pull_request: + release: + types: [released, pre-released] + +jobs: + ci: + strategy: + matrix: + version: + - 1.26.1 # MSRV + - stable + - nightly + os: [ubuntu-latest, macos-latest, windows-latest] + fail-fast: false # macOS sometimes fails to test + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: setup toolchain + run: | + rustup set profile minimal + rustup toolchain install ${{ matrix.version }} + rustup override set ${{ matrix.version }} + + - name: MSRV check + if: matrix.version == '1.26.1' + shell: bash + run: | + mv Cargo.lock.min Cargo.lock + cargo build + + - name: check build + if: matrix.version != '1.26.1' + run: | + cargo test --no-fail-fast + + audit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: install cargo-audit + run: | + rustup override set stable + cargo install cargo-audit + + - name: audit check + run: cargo audit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c902e801..00000000 --- a/.travis.yml +++ /dev/null @@ -1,96 +0,0 @@ -dist: xenial -language: rust - -cache: - - directories: - - $HOME/.cargo - - target/debug/deps - - target/$TARGET/debug/deps -before_cache: - # Travis can't cache files that are not readable by "others" - - chmod -R a+r $HOME/.cargo - -matrix: - fast_finish: true - include: - - # Audit only - - env: CARGO_AUDIT=1 - - # Stable on windows first to get it going (very slow) - - os: windows - - # Linux - - os: linux - rust: nightly - - os: linux - rust: 1.26.1 - script: - - mv Cargo.lock.min Cargo.lock - - cargo build - - os: linux - - # macOS - - os: osx - rust: nightly - - os: osx - rust: 1.26.1 - script: - - mv Cargo.lock.min Cargo.lock - - cargo build - - os: osx - - # Other windowses later - - os: windows - rust: nightly - - os: windows - rust: 1.26.1 - script: - - mv Cargo.lock.min Cargo.lock - - cargo build - - # Clippy only - - env: CARGO_CLIPPY=1 - - allow_failures: - - env: CARGO_CLIPPY=1 - - os: osx # tests on macOS are very fragile, ignore status for now - -before_install: - - set -e - - | - if [ $TRAVIS_OS_NAME = windows ]; then - choco install windows-sdk-10.1 - fi - if [[ ! -z "$CARGO_AUDIT" ]]; then - which cargo-audit || cargo install --debug cargo-audit - elif [[ ! -z "$CARGO_CLIPPY" ]]; then - rustup component add clippy - fi -# --debug for faster build at the minimal expense of runtime speed - -script: - - | - if [[ ! -z "$CARGO_AUDIT" ]]; then - cargo check - cargo audit - elif [[ ! -z "$CARGO_CLIPPY" ]]; then - cargo clippy - else - cargo test --no-fail-fast - cargo test --release --no-fail-fast - fi - -after_script: set +e - -branches: - only: - # release tags - - /^v\d+\.\d+\.\d+.*$/ - - # test branches - - /^try-/ - - # main branches - - main - - next diff --git a/Cargo.toml b/Cargo.toml index b94fbc01..2b48b351 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,9 +18,10 @@ readme = "README.md" license = "CC0-1.0" keywords = ["events", "filesystem", "notify", "watch"] categories = ["filesystem"] - -[badges] -travis-ci = { repository = "notify-rs/notify", branch = "main" } +exclude = [ + "/clippy.toml", + ".github/*" +] [dependencies] bitflags = "^1.0.4" diff --git a/README.md b/README.md index 38a650d0..140e82e1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![» Crate](https://flat.badgen.net/crates/v/notify)][crate] [![» Docs](https://flat.badgen.net/badge/api/docs.rs/df3600)][docs] -[![» CI](https://flat.badgen.net/travis/notify-rs/notify/main)][build] +[![» CI](https://flat.badgen.net/github/checks/notify-rs/notify/try-v4)][build] [![» Downloads](https://flat.badgen.net/crates/d/notify)][crate] [![» Conduct](https://flat.badgen.net/badge/contributor/covenant/5e0d73)][coc] [![» Public Domain](https://flat.badgen.net/badge/license/CC0-1.0/purple)][cc0] @@ -108,7 +108,7 @@ Public Domain using the [Creative Commons Zero Declaration][cc0]. [alert-after]: https://github.com/frewsxcv/alert-after [alacritty]: https://github.com/jwilm/alacritty [artistic]: https://github.com/notify-rs/notify/blob/next/LICENSE -[build]: https://travis-ci.com/notify-rs/notify +[build]: https://github.com/notify-rs/notify/actions [cargo watch]: https://github.com/passcod/cargo-watch [cc0]: https://creativecommons.org/publicdomain/zero/1.0/ [cobalt]: https://github.com/cobalt-org/cobalt.rs diff --git a/src/fsevent.rs b/src/fsevent.rs index e552e08d..dd8504a2 100644 --- a/src/fsevent.rs +++ b/src/fsevent.rs @@ -90,6 +90,7 @@ struct StreamContextInfo { } extern "C" { + /// Indicates whether the run loop is waiting for an event. pub fn CFRunLoopIsWaiting(runloop: cf::CFRunLoopRef) -> bool; }