Improve the monorepo support #2654
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- staging # for bors | |
- trying # for bors | |
schedule: | |
- cron: "0 0 * * 0" | |
permissions: | |
pull-requests: write | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --locked --verbose | |
- name: Check without default features | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
args: --locked --no-default-features --verbose | |
typos: | |
name: Typos | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check typos | |
uses: crate-ci/typos@master | |
test: | |
name: Test suite | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Checkout | |
if: github.event_name != 'pull_request' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Setup cargo-tarpaulin | |
uses: taiki-e/install-action@cargo-tarpaulin | |
- name: Run tests | |
run: | | |
cargo test --no-default-features \ | |
-- --skip "repo::test::git_upstream_remote" | |
- name: Run tests | |
run: | | |
cargo tarpaulin --out xml --verbose --all-features \ | |
-- --skip "repo::test::git_upstream_remote" | |
- name: Upload reports to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
name: code-coverage-report | |
file: cobertura.xml | |
flags: unit-tests | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
clippy: | |
name: Lints | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: clippy | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check the lints | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --tests --verbose -- -D warnings | |
- name: Check the pedantic lints | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: > | |
--all-targets --verbose -- -W clippy::pedantic | |
-A clippy::needless_raw_string_hashes | |
-A clippy::unreadable_literal | |
-A clippy::redundant_else | |
-A clippy::items_after_statements | |
-A clippy::missing_errors_doc | |
-A clippy::module_name_repetitions | |
-A clippy::uninlined_format_args | |
-A clippy::manual_string_new | |
-A clippy::must_use_candidate | |
-A clippy::too_many_lines | |
-A clippy::wildcard_imports | |
-A clippy::missing_panics_doc | |
-A clippy::inefficient_to_string | |
-A clippy::redundant_closure_for_method_calls | |
-A clippy::map_unwrap_or | |
-A clippy::struct_excessive_bools | |
-A clippy::unnecessary_wraps | |
rustfmt: | |
name: Formatting | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check the formatting | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check --verbose | |
lychee: | |
name: Links | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check the links | |
uses: lycheeverse/lychee-action@v1 | |
with: | |
args: -v --max-concurrency 1 *.md website/docs/* website/blog/* | |
fail: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
msrv: | |
name: Check Rust version | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install cargo-binstall | |
uses: taiki-e/install-action@cargo-binstall | |
- name: Install cargo-msrv | |
run: cargo binstall -y cargo-msrv | |
- name: Run cargo-msrv | |
shell: bash | |
run: | | |
for package in "git-cliff" "git-cliff-core"; do | |
printf "Checking MSRV for $package..." | |
cargo msrv --output-format json --path "$package" verify | tail -n 1 | jq --exit-status '.success' | |
done | |
tarball: | |
name: Check NodeJS tarball | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: "https://registry.npmjs.org" | |
- name: Validate the files in the tarball | |
shell: bash | |
working-directory: npm/git-cliff | |
run: | | |
yarn install | |
yarn build | |
cp ../../README.md . | |
cp ../../CHANGELOG.md . | |
files_expected_in_tarball=( | |
"CHANGELOG.md" | |
"README.md" | |
"lib/cjs/index.cjs" | |
"lib/cjs/index.cjs.map" | |
"lib/cjs/index.d.cts" | |
"lib/cli/cli.js" | |
"lib/esm/index.d.ts" | |
"lib/esm/index.js" | |
"lib/esm/index.js.map" | |
"package.json" | |
) | |
tarball_output=$(yarn pack --dry-run) | |
for file in "${files_expected_in_tarball[@]}"; do | |
if [[ ! "$tarball_output" == *"$file"* ]]; then | |
echo "Error: Expected file '$file' not found in tarball." | |
exit 1 | |
fi | |
done | |
profiler: | |
name: Run profiler | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Run profiler | |
run: cargo run --profile bench --features profiler -- --no-exec | |
- name: Upload report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: git-cliff.${{ github.run_id }}-profiler-report | |
path: git-cliff.**.flamegraph.svg | |
nix-flake: | |
name: Build Nix flake | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: nixbuild/nix-quick-install-action@v27 | |
- name: Restore and cache Nix store | |
uses: nix-community/cache-nix-action@v5 | |
with: | |
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }} | |
restore-prefixes-first-match: nix-${{ runner.os }}- | |
gc-max-store-size-linux: 1073741824 | |
purge: false | |
- name: Check Nix flake | |
run: nix flake check --all-systems -Lv --show-trace |