watchexec/.github/workflows/tests.yml

147 lines
3.7 KiB
YAML
Raw Normal View History

2022-09-07 02:36:55 +02:00
name: Test suite
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
2022-09-07 02:36:55 +02:00
push:
branches:
- main
tags-ignore:
- "*"
2022-09-07 04:15:38 +02:00
env:
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
2023-01-06 14:53:49 +01:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
2022-09-07 02:36:55 +02:00
jobs:
test:
strategy:
fail-fast: false
2022-09-07 02:36:55 +02:00
matrix:
platform:
- macos
- ubuntu
- windows
2023-03-02 03:33:39 +01:00
name: Test ${{ matrix.platform }}
2022-09-07 02:36:55 +02:00
runs-on: "${{ matrix.platform }}-latest"
steps:
- uses: actions/checkout@v4
2022-09-07 04:15:38 +02:00
- name: Configure toolchain
run: |
2023-03-02 03:33:39 +01:00
rustup toolchain install --profile minimal --no-self-update stable
rustup default stable
2022-09-07 05:41:34 +02:00
# 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%"
2023-01-06 14:53:49 +01:00
- name: Cargo caching
uses: actions/cache@v4
2022-09-07 04:15:38 +02:00
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
2023-03-02 03:33:39 +01:00
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.lock') }}
2022-09-07 04:15:38 +02:00
restore-keys: |
2023-03-02 03:33:39 +01:00
${{ runner.os }}-cargo-stable-
2022-09-07 04:15:38 +02:00
${{ runner.os }}-cargo-
2023-01-06 14:53:49 +01:00
- name: Compilation caching
uses: actions/cache@v4
2023-01-06 14:53:49 +01:00
with:
path: target/
2023-03-02 03:33:39 +01:00
key: ${{ runner.os }}-target-stable-${{ hashFiles('**/Cargo.lock') }}
2023-01-11 16:35:34 +01:00
2022-09-07 04:15:38 +02:00
- name: Run test suite
2023-01-11 16:35:34 +01:00
run: cargo test ${{ env.flags }}
2022-09-07 04:15:38 +02:00
- name: Check that CLI runs
2023-01-11 16:35:34 +01:00
run: cargo run ${{ env.flags }} -p watchexec-cli -- -1 echo
2023-01-06 14:53:49 +01:00
- name: Install coreutils on mac
if: ${{ matrix.platform == 'macos' }}
run: brew install coreutils
- name: Run watchexec integration tests (unix)
if: ${{ matrix.platform != 'windows' }}
run: crates/cli/run-tests.sh
shell: bash
env:
WATCHEXEC_BIN: target/debug/watchexec
- name: Run bosion integration tests
run: ./run-tests.sh
working-directory: crates/bosion
2023-03-05 05:06:24 +01:00
shell: bash
- name: Generate manpage
2023-03-18 10:34:33 +01:00
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/
2023-01-06 14:53:49 +01:00
cross-checks:
name: Checks only against select targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2023-01-06 14:53:49 +01:00
- 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@v4
2023-01-06 14:53:49 +01:00
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
2023-01-11 16:35:34 +01:00
tests-pass:
if: always()
2023-01-11 16:35:34 +01:00
name: Tests pass
needs:
- test
- cross-checks
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}