Skip to content

Commit

Permalink
Update CI
Browse files Browse the repository at this point in the history
- Reduce frequency of dependency audit to once per week
- Eliminate auto-closure of stale PRs
- Eliminate weekly check of feature powerset
- Add caching to miri
- Move caching earlier
- Use existing actions to install tooling
- Reduce quickcheck iterations when running miri (for speed)
  • Loading branch information
jhpratt committed Jan 28, 2024
1 parent 589ff6b commit 6747ebe
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 114 deletions.
82 changes: 28 additions & 54 deletions .github/workflows/build.yaml
Expand Up @@ -5,7 +5,6 @@ concurrency:
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0
TYPE_CHECK_TARGETS: '{
"no_std": [
"thumbv7em-none-eabihf"
Expand Down Expand Up @@ -83,6 +82,9 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Generate target list
run: |
echo $TYPE_CHECK_TARGETS \
Expand All @@ -95,15 +97,7 @@ jobs:
targets: ${{ env.TARGETS }}

- name: Install cargo-hack
shell: bash
run: |
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz \
| tar xzf - -C ~/.cargo/bin
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.kind.name }}
uses: taiki-e/install-action@cargo-hack

- name: Check feature powerset
env:
Expand Down Expand Up @@ -135,12 +129,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Type-check benchmarks
run: cargo check -p time --benches --all-features
env:
Expand All @@ -164,27 +158,14 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust.version }}

- name: Install cargo-hack
run: |
host=$(rustc -Vv | grep host | sed 's/host: //')
if [[ $host =~ windows ]]; then
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${host}.zip -o cargo-hack.zip
7z x cargo-hack.zip -o$HOME/.cargo/bin
elif [[ $host =~ darwin|linux ]]; then
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${host}.tar.gz | tar xzf - -C ~/.cargo/bin
else
echo "unsupported operating system"
exit 1
fi
- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test -p time --all-features

Expand All @@ -197,6 +178,9 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
Expand All @@ -206,6 +190,7 @@ jobs:
run: cargo miri test -p time --all-features
env:
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check
QUICKCHECK_MAX_TESTS: 100

cross-build:
name: Cross-build
Expand All @@ -216,14 +201,14 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-gnu

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install dependencies
run: sudo apt install gcc-mingw-w64

Expand Down Expand Up @@ -259,23 +244,14 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Install targets
run: |
rustup target add \
x86_64-unknown-linux-gnu \
aarch64-apple-darwin \
x86_64-pc-windows-gnu \
x86_64-unknown-netbsd \
x86_64-unknown-illumos \
wasm32-wasi
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
targets: x86_64-unknown-linux-gnu,aarch64-apple-darwin,x86_64-pc-windows-gnu,x86_64-unknown-netbsd,x86_64-unknown-illumos,wasm32-wasi

- name: Run clippy
run: |
Expand Down Expand Up @@ -303,12 +279,12 @@ jobs:
with:
persist-credentials: false

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Document public API
run: cargo doc -p time --all-features
env:
Expand Down Expand Up @@ -362,16 +338,14 @@ jobs:
with:
persist-credentials: false

- name: Cache cargo output
uses: Swatinem/rust-cache@v2

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install cargo-llvm-cov
run: |
curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz \
| tar xzf - -C ~/.cargo/bin
- name: Cache cargo output
uses: Swatinem/rust-cache@v2
uses: taiki-e/install-action@cargo-llvm-cov

- name: Generate coverage report
run: |
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/dependency-audit.yaml
@@ -0,0 +1,22 @@
name: Dependency audit

on:
schedule:
- cron: "0 0 * * 1" # midnight on Monday
workflow_dispatch:

jobs:
security-audit:
name: Dependency audit
runs-on: ubuntu-latest
permissions:
issues: write
checks: write
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Audit dependencies
uses: rustsec/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/github-release.yaml
@@ -0,0 +1,24 @@
name: GitHub release

on:
workflow_call:
inputs:
prerelease:
required: false
type: boolean

jobs:
release:
name: Create release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create release
uses: ncipollo/release-action@v1
with:
body: See the [changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md) for details.
prerelease: ${{ inputs.prerelease }}
32 changes: 9 additions & 23 deletions .github/workflows/powerset.yaml
Expand Up @@ -34,8 +34,6 @@ defaults:
shell: bash

on:
schedule:
- cron: "0 0 * * 1" # midnight on Monday
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
Expand Down Expand Up @@ -87,10 +85,7 @@ jobs:
toolchain: ${{ matrix.rust.version}}

- name: Install cargo-hack
shell: bash
run: |
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz \
| tar xzf - -C ~/.cargo/bin
uses: taiki-e/install-action@cargo-hack

- name: Check feature powerset
run: |
Expand All @@ -109,20 +104,11 @@ jobs:
name: Create release
if: startsWith(github.ref, 'refs/tags') && github.run_attempt == 1
needs: check
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create release
uses: ncipollo/release-action@v1
with:
body: See the [changelog](https://github.com/time-rs/time/blob/main/CHANGELOG.md) for details.
prerelease: |
${{
contains(github.ref, 'alpha')
|| contains(github.ref, 'beta')
|| contains(github.ref, 'rc')
}}
uses: ./.github/workflows/github-release.yaml
with:
prerelease: |
${{
contains(github.ref, 'alpha')
|| contains(github.ref, 'beta')
|| contains(github.ref, 'rc')
}}
37 changes: 0 additions & 37 deletions .github/workflows/scheduled.yaml

This file was deleted.

0 comments on commit 6747ebe

Please sign in to comment.