Merge pull request #3924 from influxdata/cn/auto-hakari

feat: Auto commit cargo hakari generate changes
pull/24376/head
kodiakhq[bot] 2022-03-04 15:52:22 +00:00 committed by GitHub
commit c0ea6d1cfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 13 deletions

View File

@ -166,23 +166,34 @@ jobs:
# https://github.com/rust-lang/cargo/issues/10280
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
steps:
- add_ssh_keys:
fingerprints:
- "77:99:88:4a:ac:1f:55:9e:39:c7:1f:e4:7f:1e:60:4b"
- checkout
- rust_components
- cache_restore
- run:
name: Check that the workspace hack crate contains all features in use
name: Configure git
command: |
cargo hakari generate --diff || {
echo "If this fails, fix it by running \`cargo hakari generate\` locally and committing the changes"
exit 1
}
git config user.email "circleci@influxdata.com"
git config user.name "CircleCI[bot]"
- run:
name: Check that all crates in the workspace depend on the workspace hack crate
name: Commit any changes from cargo hakari
command: |
cargo hakari manage-deps --dry-run || {
echo "If this fails, fix it by running \`cargo hakari manage-deps\` locally and committing the changes"
cargo hakari generate
cargo hakari manage-deps -y
if [[ $(git status --porcelain) ]] ; then
if [[ $(git rev-list --count --author=CircleCI origin/main..) -ne 0 ]]; then
echo "There's already a cargo hakari commit on this branch, but there are cargo hakari changes... something is wrong."
else
git commit -am "chore: Run cargo hakari tasks"
git push origin "$CIRCLE_BRANCH"
echo "Cargo hakari changes need to be committed before merging this branch."
fi
exit 1
}
else
echo "No changes to commit"
fi
test:
# setup multiple docker images (see https://circleci.com/docs/2.0/configuration-reference/#docker)