mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-10 21:36:43 +01:00
652b8c9b2f
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
137 lines
3.6 KiB
YAML
137 lines
3.6 KiB
YAML
name: Test suite
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
push:
|
|
branches:
|
|
- main
|
|
tags-ignore:
|
|
- "*"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- macos
|
|
- ubuntu
|
|
- windows
|
|
|
|
name: Test ${{ matrix.platform }}
|
|
runs-on: "${{ matrix.platform }}-latest"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Configure toolchain
|
|
run: |
|
|
rustup toolchain install --profile minimal --no-self-update stable
|
|
rustup default stable
|
|
|
|
# https://github.com/actions/cache/issues/752
|
|
- if: ${{ runner.os == 'Windows' }}
|
|
name: Use GNU tar
|
|
shell: cmd
|
|
run: |
|
|
echo "Adding GNU tar to PATH"
|
|
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
|
|
|
|
- name: Cargo caching
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-stable-
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: Compilation caching
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: target/
|
|
key: ${{ runner.os }}-target-stable-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Run test suite
|
|
run: cargo test ${{ env.flags }}
|
|
- name: Check that CLI runs
|
|
run: cargo run ${{ env.flags }} -p watchexec-cli -- -1 echo
|
|
|
|
- name: Run bosion integration tests
|
|
run: ./run-tests.sh
|
|
working-directory: crates/bosion
|
|
shell: bash
|
|
|
|
- name: Generate manpage
|
|
run: cargo run ${{ env.flags }} -p watchexec-cli -- --manual > doc/watchexec.1
|
|
- name: Check that manpage is up to date
|
|
run: git diff --exit-code -- doc/
|
|
|
|
- name: Generate completions
|
|
run: bin/completions
|
|
- name: Check that completions are up to date
|
|
run: git diff --exit-code -- completions/
|
|
|
|
cross-checks:
|
|
name: Checks only against select targets
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Configure toolchain
|
|
run: |
|
|
rustup toolchain install --profile minimal --no-self-update stable
|
|
rustup default stable
|
|
|
|
sudo apt-get install -y musl-tools
|
|
rustup target add x86_64-unknown-linux-musl
|
|
|
|
- name: Install cross
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cross
|
|
|
|
- name: Cargo caching
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-stable-
|
|
${{ runner.os }}-cargo-
|
|
|
|
- run: cargo check --target x86_64-unknown-linux-musl
|
|
- run: cross check --target x86_64-unknown-freebsd
|
|
- run: cross check --target x86_64-unknown-netbsd
|
|
|
|
# Dummy job to have a stable name for the "all tests pass" requirement
|
|
tests-pass:
|
|
if: always() # always run even if dependencies fail
|
|
name: Tests pass
|
|
needs:
|
|
- test
|
|
- cross-checks
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# fail if ANY dependency has failed or been skipped or cancelled
|
|
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')"
|
|
run: exit 1
|