Skip to content

Commit 47b5b02

Browse files
chore(ci): split deny check into optional (all) and required (licenses) (vectordotdev#24990)
ci(deny): split deny check into optional (all) and required (licenses) Co-authored-by: Pavlos Rontidis <pavlos.rontidis@gmail.com>
1 parent 753cf9a commit 47b5b02

3 files changed

Lines changed: 38 additions & 6 deletions

File tree

.github/workflows/deny.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ on:
2626
type: string
2727

2828
pull_request:
29+
merge_group:
30+
types: [checks_requested]
2931
schedule:
3032
# Same schedule as nightly.yml
3133
- cron: "0 5 * * 2-6" # Runs at 5:00 AM UTC, Tuesday through Saturday
3234

3335
concurrency:
34-
group: ${{ github.workflow }}-${{ github.ref }}
36+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
3537
cancel-in-progress: true
3638

3739
permissions:
@@ -48,8 +50,6 @@ jobs:
4850
timeout-minutes: 30
4951
if: ${{ always() && (github.event_name != 'pull_request' || needs.changes.outputs.deny == 'true') }}
5052
needs: [changes]
51-
env:
52-
CARGO_INCREMENTAL: 0
5353
steps:
5454
- name: Checkout branch
5555
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -61,5 +61,24 @@ jobs:
6161
mold: false
6262
cargo-deny: true
6363

64-
- name: Check cargo deny advisories/licenses
64+
- name: Check cargo deny (all)
6565
run: make check-deny
66+
67+
test-deny-licenses:
68+
runs-on: ubuntu-24.04
69+
timeout-minutes: 30
70+
if: ${{ always() && (github.event_name != 'pull_request' || needs.changes.outputs.deny == 'true') }}
71+
needs: [changes]
72+
steps:
73+
- name: Checkout branch
74+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
75+
with:
76+
ref: ${{ inputs.ref }}
77+
78+
- uses: ./.github/actions/setup
79+
with:
80+
mold: false
81+
cargo-deny: true
82+
83+
- name: Check cargo deny licenses
84+
run: make check-deny-licenses

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,10 @@ check-scripts: ## Check that scripts do not have common mistakes
518518
check-deny: ## Check advisories licenses and sources for crate dependencies
519519
${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check deny
520520

521+
.PHONY: check-deny-licenses
522+
check-deny-licenses: ## Check licenses for crate dependencies
523+
${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check deny --licenses-only
524+
521525
.PHONY: check-events
522526
check-events: ## Check that events satisfy patterns set in https://github.com/vectordotdev/vector/blob/master/rfcs/2020-03-17-2064-event-driven-observability.md
523527
${MAYBE_ENVIRONMENT_EXEC} $(VDEV) check events

vdev/src/commands/check/deny.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@ use crate::app;
55
/// Check for advisories, licenses, and sources for crate dependencies
66
#[derive(clap::Args, Debug)]
77
#[command()]
8-
pub struct Cli {}
8+
pub struct Cli {
9+
/// Only check licenses
10+
#[arg(long)]
11+
licenses_only: bool,
12+
}
913

1014
impl Cli {
1115
pub fn exec(self) -> Result<()> {
16+
let check = if self.licenses_only {
17+
"licenses"
18+
} else {
19+
"all"
20+
};
1221
app::exec(
1322
"cargo",
1423
[
@@ -17,7 +26,7 @@ impl Cli {
1726
"error",
1827
"--all-features",
1928
"check",
20-
"all",
29+
check,
2130
],
2231
true,
2332
)

0 commit comments

Comments
 (0)