Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
- name: install the repository Rust toolchain
run: rustup toolchain install "$RUST_VERSION" --profile minimal --no-self-update
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-nextest@0.9.149,cargo-deny@0.20.2,taplo-cli@0.10.0
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: just@1.59.0
fallback: none
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mutants-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: install the repository Rust toolchain
run: rustup toolchain install "$RUST_VERSION" --profile minimal --no-self-update
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-mutants@27.1.0,cargo-nextest
- name: regenerate the complete mutation outcome inventory
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ jobs:
env:
CANDIDATE_SHA: ${{ needs.candidate.outputs.revision }}
run: cargo run --locked --quiet -p xtask -- ci source --revision "$CANDIDATE_SHA" --output "$GITHUB_OUTPUT"
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-nextest@0.9.149,cargo-deny@0.20.2,taplo-cli@0.10.0
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: just@1.59.0
fallback: none
Expand Down Expand Up @@ -128,10 +128,10 @@ jobs:
CANDIDATE_SHA: ${{ needs.candidate.outputs.revision }}
shell: bash
run: cargo run --locked --quiet -p xtask -- ci source --revision "$CANDIDATE_SHA" --output "$GITHUB_OUTPUT"
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-nextest@0.9.149
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: just@1.59.0
fallback: none
Expand Down Expand Up @@ -167,10 +167,10 @@ jobs:
env:
CANDIDATE_SHA: ${{ needs.candidate.outputs.revision }}
run: cargo run --locked --quiet -p xtask -- ci source --revision "$CANDIDATE_SHA" --output "$GITHUB_OUTPUT"
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-nextest@0.9.149
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: just@1.59.0
fallback: none
Expand Down Expand Up @@ -242,7 +242,7 @@ jobs:
- name: install bare-metal target
run: rustup target add thumbv7em-none-eabi
- name: install pinned Just
uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: just@1.59.0
fallback: none
Expand Down Expand Up @@ -400,11 +400,11 @@ jobs:
env:
CANDIDATE_SHA: ${{ needs.candidate.outputs.revision }}
run: cargo run --locked --quiet -p xtask -- ci source --revision "$CANDIDATE_SHA" --output "$GITHUB_OUTPUT"
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-llvm-cov@0.9.1,cargo-nextest@0.9.149
- name: install pinned Just
uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: just@1.59.0
fallback: none
Expand Down Expand Up @@ -443,7 +443,7 @@ jobs:
env:
CANDIDATE_SHA: ${{ needs.candidate.outputs.revision }}
run: cargo run --locked --quiet -p xtask -- ci source --revision "$CANDIDATE_SHA" --output "$GITHUB_OUTPUT"
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-mutants@27.1.0,cargo-nextest@0.9.149
- name: confirm the committed full mutation inventory
Expand Down Expand Up @@ -521,12 +521,12 @@ jobs:
env:
CANDIDATE_SHA: ${{ needs.candidate.outputs.revision }}
run: cargo run --locked --quiet -p xtask -- ci source --revision "$CANDIDATE_SHA" --output "$GITHUB_OUTPUT"
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: cargo-fuzz@0.13.2
- name: install the verified nightly toolchain
run: rustup toolchain install "$NIGHTLY_TOOLCHAIN" --profile minimal --no-self-update
- uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31
- uses: taiki-e/install-action@68a389c788b2cd04016ce8c80ee23b80d2ab3d68 # v2.88.1
with:
tool: just@1.59.0
fallback: none
Expand Down Expand Up @@ -634,7 +634,7 @@ jobs:
env:
CANDIDATE_SHA: ${{ needs.candidate.outputs.revision }}
run: cargo run --locked --quiet -p xtask -- ci source --revision "$CANDIDATE_SHA" --output "$GITHUB_OUTPUT"
- uses: release-plz/action@8b5bf233ecb5779f63508db7cd050e948ee77cc2 # v0.5.144
- uses: release-plz/action@f67a7e724bdad4a0f6875f186060a0ca2770d76c # v0.5.147
with:
command: release
version: 0.3.174
Expand Down Expand Up @@ -688,7 +688,7 @@ jobs:
persist-credentials: false
- name: install the repository Rust toolchain
run: rustup toolchain install "$RUST_VERSION" --profile minimal --no-self-update
- uses: release-plz/action@8b5bf233ecb5779f63508db7cd050e948ee77cc2 # v0.5.144
- uses: release-plz/action@f67a7e724bdad4a0f6875f186060a0ca2770d76c # v0.5.147
with:
command: release-pr
version: 0.3.174
Expand Down
16 changes: 16 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
"matchStrings": ["CARGO_SORT_VERSION:\\s*(?<currentValue>\\d+\\.\\d+\\.\\d+)"],
"datasourceTemplate": "crate",
"depNameTemplate": "cargo-sort"
},
{
"customType": "regex",
"managerFilePatterns": ["/^xtask/tests/ci_workflow\\.rs$/"],
"matchStrings": [
"/// renovate: datasource=github-tags depName=release-plz/action currentValue=(?<currentValue>v\\d+\\.\\d+\\.\\d+)\\s+const PUBLISHER_ACTION: &str =\\s*\"release-plz/action@(?<currentDigest>[a-f0-9]{40})\";"
],
"datasourceTemplate": "github-tags",
"depNameTemplate": "release-plz/action"
}
],
"packageRules": [
{
"matchDepNames": ["release-plz/action"],
"matchManagers": ["github-actions", "custom.regex"],
"groupName": "release-plz action bindings"
}
]
}
43 changes: 39 additions & 4 deletions xtask/tests/ci_workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use std::path::Path;
use anyhow::{Context, Result, ensure};
use yaml_rust2::{Yaml, YamlLoader};

/// renovate: datasource=github-tags depName=release-plz/action currentValue=v0.5.147
const PUBLISHER_ACTION: &str = "release-plz/action@f67a7e724bdad4a0f6875f186060a0ca2770d76c";

fn workflow(name: &str) -> Result<Yaml> {
let root = Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
Expand Down Expand Up @@ -244,10 +247,7 @@ fn release_contract(source: &Yaml) -> Result<()> {
let steps = publisher["steps"].as_vec().context("publisher steps")?;
let action = steps
.iter()
.find(|step| {
step["uses"].as_str()
== Some("release-plz/action@8b5bf233ecb5779f63508db7cd050e948ee77cc2")
})
.find(|step| step["uses"].as_str() == Some(PUBLISHER_ACTION))
.context("immutable publisher action")?;
ensure!(
action["with"]["version"].as_str() == Some("0.3.174"),
Expand Down Expand Up @@ -752,6 +752,41 @@ fn publication_requires_complete_same_source_qualification() {
);
}

#[test]
fn publisher_requires_the_reviewed_immutable_action_and_settings() {
let original = workflow("release-plz.yml").unwrap();
release_contract(&original).unwrap();
for reference in [
"release-plz/action@8b5bf233ecb5779f63508db7cd050e948ee77cc2",
"release-plz/action@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"release-plz/action@v0.5",
"another/action@f67a7e724bdad4a0f6875f186060a0ca2770d76c",
] {
let mut changed = original.clone();
let Yaml::Array(steps) = &mut changed["jobs"]["release-plz-release"]["steps"] else {
unreachable!()
};
let action = steps
.iter_mut()
.find(|step| step["uses"].as_str() == Some(PUBLISHER_ACTION))
.unwrap();
action["uses"] = Yaml::String(reference.to_owned());
assert!(release_contract(&changed).is_err(), "publisher {reference}");
}
for (setting, value) in [("version", "0.4.2"), ("command", "release-pr")] {
let mut changed = original.clone();
let Yaml::Array(steps) = &mut changed["jobs"]["release-plz-release"]["steps"] else {
unreachable!()
};
let action = steps
.iter_mut()
.find(|step| step["uses"].as_str() == Some(PUBLISHER_ACTION))
.unwrap();
action["with"][setting] = Yaml::String(value.to_owned());
assert!(release_contract(&changed).is_err(), "publisher {setting}");
}
}

#[test]
fn removing_a_role_source_guard_or_publisher_binding_is_rejected() {
let original = workflow("release-plz.yml").unwrap();
Expand Down
Loading