diff --git a/.github/actions/install_deps/action.yml b/.github/actions/install_deps/action.yml deleted file mode 100644 index 624b1ab..0000000 --- a/.github/actions/install_deps/action.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: "Install_deps" -description: "Installs the dependencies and updates the system" - -runs: - using: "composite" - steps: - - name: Install dependencies - run: | - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - sudo apt-get update -q -y && sudo apt-get upgrade -y - sudo apt-get install -y libxdo-dev libxtst-dev libevdev-dev diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0e00ee4..e044df8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -7,57 +7,47 @@ on: pull_request: branches: [main, release-*] -env: - CARGO_TERM_COLOR: always - jobs: - clippy_workspace: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/install_deps - - name: Add clippy - uses: actions-rs/toolchain@v1.0.6 - with: - profile: minimal - default: true - components: clippy - - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --all-targets -- -D warnings + build: - rust_fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/install_deps - - name: Add rustfmt - uses: actions-rs/toolchain@v1.0.6 - with: - profile: minimal - default: true - components: rustfmt - - uses: Swatinem/rust-cache@v2 - - run: | - cargo fmt -- --check - - rust_build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/install_deps - - uses: Swatinem/rust-cache@v2 - - run: cargo build --all-features --verbose + runs-on: ${{matrix.os}} + env: + DISPLAY: ':99' + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + include: + - os: ubuntu-latest + headless: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & + - os: ubuntu-latest + dependencies: sudo apt-get install libxtst-dev libevdev-dev --assume-yes + - os: macos-latest + # TODO: We can't test this on github, we can't set accessibility yet. + test: cargo test --verbose --all-features -- --skip test_listen_and_simulate --skip test_grab + - os: ubuntu-latest + # TODO unstable_grab feature is not supported on Linux. + test: cargo test --verbose --features=serialize + - os: windows-latest + test: cargo test --verbose --all-features - run_tests: - name: Run tests - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/install_deps - - uses: Swatinem/rust-cache@v2 - - run: | - cargo test --all-features --lib --bins --tests --verbose - cargo test --benches + - uses: actions/checkout@v2 + - name: CargoFmt + run: rustup component add rustfmt + - name: Dependencies + run: ${{matrix.dependencies}} + - name: Setup headless environment + run: ${{matrix.headless}} + - name: Check formatting + run: | + rustup component add rustfmt + cargo fmt -- --check + - name: Build + run: cargo build --verbose + - name: Run tests + run: ${{matrix.test}} + - name: Linter + run: | + rustup component add clippy + cargo clippy --all-features --verbose -- -Dwarnings \ No newline at end of file