diff --git a/.github/workflows/build-reusable.yml b/.github/workflows/build-reusable.yml new file mode 100644 index 0000000..972faa1 --- /dev/null +++ b/.github/workflows/build-reusable.yml @@ -0,0 +1,62 @@ +name: Build + +on: + workflow_call: + inputs: + rust_version: + type: string + description: Rust version to use in the build + required: false + default: stable + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ inputs.rust_version }} + components: rustfmt, clippy + - name: Install cargo-deny + uses: baptiste0928/cargo-install@v2 + with: + crate: cargo-deny + version: "^0.14" + + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo + + - name: Format + run: cargo fmt --all -- --check + - name: Clippy + run: cargo clippy --workspace --all-features --all-targets -- -D warnings + - name: Clippy (no features) + run: cargo clippy -p term-transcript --no-default-features --lib + - name: Clippy (features = svg) + run: cargo clippy -p term-transcript --no-default-features --features svg --lib -- -D warnings + - name: Clippy (features = test) + run: cargo clippy -p term-transcript --no-default-features --features test --lib -- -D warnings + + - name: Check dependencies + run: cargo deny --workspace --all-features check + + - name: Run tests + run: cargo test --workspace --all-features --all-targets + - name: Run doc tests + run: cargo test --workspace --all-features --doc + + - name: Generate snapshots + run: ./examples/generate-snapshots.sh + - name: Test CLI tracing + run: | + RUST_LOG=term_transcript=debug \ + cargo run -p term-transcript-cli --all-features -- \ + exec 'echo Hello' |& grep INFO diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe67b77..23f099d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,55 +46,7 @@ jobs: run: cargo test -p term-transcript ${{ matrix.features }} --doc build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Install Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - components: rustfmt, clippy - - name: Install cargo-deny - uses: baptiste0928/cargo-install@v2 - with: - crate: cargo-deny - version: "^0.14" - - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ runner.os }}-cargo - - - name: Format - run: cargo fmt --all -- --check - - name: Clippy - run: cargo clippy --workspace --all-features --all-targets -- -D warnings - - name: Clippy (no features) - run: cargo clippy -p term-transcript --no-default-features --lib - - name: Clippy (features = svg) - run: cargo clippy -p term-transcript --no-default-features --features svg --lib -- -D warnings - - name: Clippy (features = test) - run: cargo clippy -p term-transcript --no-default-features --features test --lib -- -D warnings - - - name: Check dependencies - run: cargo deny --workspace --all-features check - - - name: Run tests - run: cargo test --workspace --all-features --all-targets - - name: Run doc tests - run: cargo test --workspace --all-features --doc - - - name: Generate snapshots - run: ./examples/generate-snapshots.sh - - name: Test CLI tracing - run: | - RUST_LOG=term_transcript=debug \ - cargo run -p term-transcript-cli --all-features -- \ - exec 'echo Hello' |& grep INFO + uses: ./.github/workflows/build-reusable.yml build-docker: needs: diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml new file mode 100644 index 0000000..335dd45 --- /dev/null +++ b/.github/workflows/scheduled.yml @@ -0,0 +1,9 @@ +name: Scheduled checks + +on: + schedule: + - cron: "0 2 * * MON" + +jobs: + build: + uses: ./.github/workflows/build-reusable.yml