diff --git a/github/workflows/check.yml b/github/workflows/check.yml new file mode 100644 index 0000000..81c3a01 --- /dev/null +++ b/github/workflows/check.yml @@ -0,0 +1,107 @@ +on: + push: + branches: [main] + pull_request: +name: check +jobs: + fmt: + runs-on: ubuntu-latest + name: stable / fmt + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: rustfmt + - name: cargo fmt --check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --check + clippy: + runs-on: ubuntu-latest + name: ${{ matrix.toolchain }} / clippy + strategy: + fail-fast: false + matrix: + toolchain: [stable, beta] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install ${{ matrix.toolchain }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.toolchain }} + default: true + components: clippy + - name: cargo clippy + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + doc: + runs-on: ubuntu-latest + name: nightly / doc + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install nightly + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + default: true + - name: cargo doc + uses: actions-rs/cargo@v1 + with: + command: doc + args: --no-deps --all-features + env: + RUSTDOCFLAGS: --cfg docsrs + hack: + runs-on: ubuntu-latest + name: ubuntu / stable / features + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: cargo hack + uses: actions-rs/cargo@v1 + with: + command: hack + args: --feature-powerset check --all-targets + msrv: + runs-on: ubuntu-latest + # we use a matrix here just because env can't be used in job names + # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability + strategy: + matrix: + msrv: [1.56.1] # 2021 edition requires 1.56 + name: ubuntu / ${{ matrix.msrv }} + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install ${{ matrix.toolchain }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.msrv }} + default: true + - name: cargo +${{ matrix.msrv }} check + uses: actions-rs/cargo@v1 + with: + command: check diff --git a/github/workflows/coverage.yml b/github/workflows/coverage.yml deleted file mode 100644 index 375f7a3..0000000 --- a/github/workflows/coverage.yml +++ /dev/null @@ -1,26 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: coverage -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: llvm-tools-preview - - name: Install cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov - - name: Generate code coverage - run: cargo llvm-cov --all-features --lcov --output-path lcov.info - - name: Upload to codecov.io - uses: codecov/codecov-action@v2 - with: - fail_ci_if_error: true diff --git a/github/workflows/features.yml b/github/workflows/features.yml deleted file mode 100644 index ac5e18e..0000000 --- a/github/workflows/features.yml +++ /dev/null @@ -1,23 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: cargo hack -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - uses: actions/checkout@v3 - with: - submodules: true - - name: Install cargo-hack - uses: taiki-e/install-action@cargo-hack - - name: cargo hack - uses: actions-rs/cargo@v1 - with: - command: hack - args: --feature-powerset check --all-targets diff --git a/github/workflows/locked.yml b/github/workflows/locked.yml deleted file mode 100644 index c67a317..0000000 --- a/github/workflows/locked.yml +++ /dev/null @@ -1,2 +0,0 @@ -# TODO: https://twitter.com/jonhoo/status/1571290371124260865 -# Maybe also: https://twitter.com/alcuadrado/status/1571291687837732873 diff --git a/github/workflows/minimal.yml b/github/workflows/minimal.yml deleted file mode 100644 index 0a558a9..0000000 --- a/github/workflows/minimal.yml +++ /dev/null @@ -1,31 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: With dependencies at minimal versions -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - uses: actions/checkout@v3 - with: - submodules: true - - name: cargo update -Zminimal-versions - uses: actions-rs/cargo@v1 - with: - command: update - toolchain: nightly - args: -Zminimal-versions - - name: cargo test - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features --all-targets diff --git a/github/workflows/msrv.yml b/github/workflows/msrv.yml deleted file mode 100644 index d6d9046..0000000 --- a/github/workflows/msrv.yml +++ /dev/null @@ -1,21 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: Minimum Supported Rust Version -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.56.1 # 2021 edition requires 1.56 - override: true - - uses: actions/checkout@v3 - with: - submodules: true - - name: cargo +1.56.1 check - uses: actions-rs/cargo@v1 - with: - command: check diff --git a/github/workflows/os-check.yml b/github/workflows/os-check.yml deleted file mode 100644 index db3590b..0000000 --- a/github/workflows/os-check.yml +++ /dev/null @@ -1,26 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: os check -jobs: - os-check: - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [macos-latest, windows-latest] - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - - uses: actions/checkout@v3 - with: - submodules: true - - name: cargo test - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features --all-targets diff --git a/github/workflows/scheduled-nightly.yml b/github/workflows/scheduled-nightly.yml deleted file mode 100644 index 5a86cca..0000000 --- a/github/workflows/scheduled-nightly.yml +++ /dev/null @@ -1 +0,0 @@ -# TODO: https://twitter.com/mycoliza/status/1571295690063753218 diff --git a/github/workflows/scheduled.yml b/github/workflows/scheduled.yml new file mode 100644 index 0000000..bb39a22 --- /dev/null +++ b/github/workflows/scheduled.yml @@ -0,0 +1,61 @@ +on: + push: + branches: [main] + pull_request: + schedule: + - cron: '7 7 * * *' +name: cargo test (rolling) +jobs: + # https://twitter.com/mycoliza/status/1571295690063753218 + nightly: + runs-on: ubuntu-latest + name: ubuntu / nightly + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install nightly + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + default: true + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - name: cargo test --locked + uses: actions-rs/cargo@v1 + with: + command: test + args: --locked --all-features --all-targets + # https://twitter.com/alcuadrado/status/1571291687837732873 + update: + runs-on: ubuntu-latest + name: ubuntu / stable / updated + # There's no point running this if no Cargo.lock was checked in in the + # first place, since we'd just redo what happened in the regular test job. + # Unfortunately, hashFiles only works in if on steps, so we reepeat it. + # if: hashFiles('Cargo.lock') != '' + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + if: hashFiles('Cargo.lock') != '' + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: cargo update + if: hashFiles('Cargo.lock') != '' + uses: actions-rs/cargo@v1 + with: + command: update + - name: cargo test + if: hashFiles('Cargo.lock') != '' + uses: actions-rs/cargo@v1 + with: + command: test + args: --locked --all-features --all-targets diff --git a/github/workflows/style.yml b/github/workflows/style.yml deleted file mode 100644 index 7a583f2..0000000 --- a/github/workflows/style.yml +++ /dev/null @@ -1,48 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: lint -jobs: - style: - runs-on: ubuntu-latest - name: ${{ matrix.toolchain }} - strategy: - fail-fast: false - matrix: - toolchain: [stable, beta] - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.toolchain }} - components: rustfmt, clippy - - uses: actions/checkout@v3 - with: - submodules: true - - name: cargo fmt --check - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --check - - name: cargo clippy - uses: actions-rs/clippy-check@v1 - if: always() - with: - token: ${{ secrets.GITHUB_TOKEN }} - doc: - runs-on: ubuntu-latest - steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: nightly - - uses: actions/checkout@v3 - - name: cargo doc - uses: actions-rs/cargo@v1 - with: - toolchain: nightly - command: doc - args: --no-deps --all-features - env: - RUSTDOCFLAGS: --cfg docsrs diff --git a/github/workflows/test.yml b/github/workflows/test.yml index dfc1819..83645f8 100644 --- a/github/workflows/test.yml +++ b/github/workflows/test.yml @@ -2,24 +2,112 @@ on: push: branches: [main] pull_request: -name: cargo test +name: test jobs: - test: + required: runs-on: ubuntu-latest name: ubuntu / ${{ matrix.toolchain }} strategy: matrix: - toolchain: [stable, beta, nightly] + toolchain: [stable, beta] steps: - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.toolchain }} - uses: actions/checkout@v3 with: submodules: true + - name: Install ${{ matrix.toolchain }} + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.toolchain }} + default: true + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + # https://twitter.com/jonhoo/status/1571290371124260865 + - name: cargo test --locked + uses: actions-rs/cargo@v1 + with: + command: test + args: --locked --all-features --all-targets + minimal: + runs-on: ubuntu-latest + name: ubuntu / stable / minimal-versions + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: Install nightly for -Zminimal-versions + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + - name: cargo update -Zminimal-versions + uses: actions-rs/cargo@v1 + with: + command: update + toolchain: nightly + args: -Zminimal-versions - name: cargo test uses: actions-rs/cargo@v1 with: command: test - args: --all-features --all-targets + args: --locked --all-features --all-targets + os-check: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} / stable + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - name: cargo test + uses: actions-rs/cargo@v1 + with: + command: test + args: --locked --all-features --all-targets + coverage: + runs-on: ubuntu-latest + name: ubuntu / stable / coverage + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + components: llvm-tools-preview + - name: cargo install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - name: cargo llvm-cov + run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info + - name: Upload to codecov.io + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true