diff --git a/.cargo-husky/hooks/pre-push b/.cargo-husky/hooks/pre-push index 89646911..81070dbe 100755 --- a/.cargo-husky/hooks/pre-push +++ b/.cargo-husky/hooks/pre-push @@ -6,6 +6,9 @@ echo "----------------------------------------------------------------------------------------" echo "These tests run automatically before the git push" echo "If you want to push your changes without testing them first, use git push --no-verify" +echo "To simplify this, create an alias, e.g. like so:" +echo " git config --global alias.pushn 'push --no-verify'" +echo "Then you can use git pushn to push without testing" echo "----------------------------------------------------------------------------------------" set -e diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2acc71a7..4dcf0f62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,24 +49,18 @@ jobs: postgis/postgis:16-3.4 -c "exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key" steps: + - uses: taiki-e/install-action@v2 + with: + tool: just - name: Checkout sources uses: actions/checkout@v4 - - name: Rust Versions - run: rustc --version && cargo --version - uses: Swatinem/rust-cache@v2 if: github.event_name != 'release' && github.event_name != 'workflow_dispatch' - - run: cargo fmt --all -- --check - - run: cargo clippy --package martin-tile-utils --tests --lib --bins --benches -- -D warnings - - run: cargo clippy --package mbtiles --tests --lib --bins --benches --no-default-features -- -D warnings - - run: cargo clippy --package mbtiles --tests --lib --bins --benches -- -D warnings - - run: cargo clippy --package martin --tests --lib --bins --benches -- -D warnings - - run: RUSTFLAGS='-D warnings' cargo check --package martin --tests --lib --bins --benches --no-default-features - - run: RUSTFLAGS='-D warnings' cargo check --package martin --tests --lib --bins --benches --no-default-features --features fonts - - run: RUSTFLAGS='-D warnings' cargo check --package martin --tests --lib --bins --benches --no-default-features --features sprites - - run: cargo clippy --package martin --features bless-tests -- -D warnings - - run: cargo doc --no-deps --workspace - env: - RUSTDOCFLAGS: '-D warnings' + - run: just env-info + - run: just fmt + - run: just clippy + - run: just check + - run: just check-doc - name: Init database run: tests/fixtures/initdb.sh env: diff --git a/justfile b/justfile index 71f0c687..7a1af436 100644 --- a/justfile +++ b/justfile @@ -275,10 +275,13 @@ fmt2: check: cargo check --workspace --all-targets --bins --tests --lib --benches +# Verify doc build +check-doc: + RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace + # Run cargo clippy clippy: cargo clippy --workspace --all-targets --bins --tests --lib --benches -- -D warnings - RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace # Validate markdown URLs with markdown-link-check clippy-md: @@ -286,8 +289,7 @@ clippy-md: 'echo -e "/workdir/README.md\n$(find /workdir/docs/src -name "*.md")" | tr "\n" "\0" | xargs -0 -P 5 -n1 -I{} markdown-link-check --config /workdir/.github/files/markdown.links.config.json {}' # These steps automatically run before git push via a git hook -[private] -git-pre-push: env-info restart lint test +git-pre-push: env-info restart fmt clippy check check-doc test # Get environment info [private] @@ -296,6 +298,7 @@ env-info: {{ just_executable() }} --version rustc --version cargo --version + rustup --version # Update sqlite database schema. prepare-sqlite: install-sqlx