mirror of
https://github.com/Hopiu/lychee.git
synced 2026-03-17 05:00:26 +00:00
112 lines
3.3 KiB
YAML
112 lines
3.3 KiB
YAML
name: CI
|
|
on:
|
|
repository_dispatch:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- "*.*.*"
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: 0
|
|
RUSTFLAGS: -D warnings
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: taiki-e/install-action@nextest
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Compile
|
|
run: cargo check --locked
|
|
- name: Test
|
|
run: make test
|
|
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Run cargo fmt (check if all code is rustfmt-ed)
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
- name: Run cargo clippy (deny warnings)
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --all-targets --all-features -- -D warnings
|
|
- uses: cargo-bins/cargo-binstall@main
|
|
- name: Verify the MSRV
|
|
run: |
|
|
cargo binstall --no-confirm cargo-msrv
|
|
make verify
|
|
|
|
publish-check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: cargo fetch
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fetch
|
|
- name: cargo publish lychee-lib
|
|
uses: actions-rs/cargo@v1
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
with:
|
|
command: publish
|
|
args: --dry-run --manifest-path lychee-lib/Cargo.toml
|
|
|
|
# Can't check lychee binary as it depends on the lib above
|
|
# and `--dry-run` doesn't allow unpublished crates yet.
|
|
# https://github.com/rust-lang/cargo/issues/1169
|
|
# `cargo-publish-all` is a solution but it doesn't work with
|
|
# Rust edition 2021.
|
|
# Therefore skip the check for now, which is probably fine
|
|
# because the binary is just a small wrapper around the CLI
|
|
# anyway.
|
|
#
|
|
# - name: cargo publish lychee
|
|
# uses: actions-rs/cargo@v1
|
|
# env:
|
|
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
# with:
|
|
# command: publish
|
|
# args: --dry-run --manifest-path lychee-bin/Cargo.toml
|
|
|
|
check-feature-flags:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Check that rustls-tls feature doesn't depend on OpenSSL
|
|
run: test -z "$( cargo tree --package lychee --no-default-features --features rustls-tls --prefix none | sed -n '/^openssl-sys /p' )"
|
|
- name: Run cargo check with default features
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --workspace --all-targets
|
|
- name: Run cargo check with all features
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --workspace --all-targets --all-features
|
|
- name: Run cargo check with rustls-tls feature
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --workspace --all-targets --no-default-features --features rustls-tls
|