-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from stepchowfun/pre-commit-test
Add documentation and a test for the pre-commit configuration
- Loading branch information
Showing
9 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# [tag:gitignore] Keep this in sync with [ref:excluded_input_paths]. | ||
# [tag:gitignore] Keep this in sync with [ref:excluded_input_paths_1] and | ||
# [ref:excluded_input_paths_2]. | ||
/artifacts/ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "tagref" | ||
version = "1.8.4" | ||
version = "1.8.5" | ||
authors = ["Stephan Boyer <[email protected]>"] | ||
edition = "2021" | ||
description = "Tagref helps you maintain cross-references in your code." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,10 +32,19 @@ tasks: | |
# - curl - Used for installing Tagref and Rust | ||
# - gcc-aarch64-linux-gnu - Used for linking the binary for AArch64 | ||
# - gcc-x86-64-linux-gnu - Used for linking the binary for x86-64 | ||
# - git - Required by pre-commit | ||
# - python3-pip - Used for installing and running pre-commit | ||
# - ripgrep - Used for various linting tasks | ||
# - shellcheck - Used for linting shell scripts | ||
apt-get update | ||
apt-get install --yes curl gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu ripgrep shellcheck | ||
apt-get install --yes \ | ||
curl \ | ||
gcc-aarch64-linux-gnu \ | ||
gcc-x86-64-linux-gnu \ | ||
git \ | ||
python3-pip \ | ||
ripgrep \ | ||
shellcheck | ||
install_tagref: | ||
description: Install Tagref, a reference checking tool. | ||
|
@@ -124,6 +133,44 @@ tasks: | |
# tests that make assertions regarding the output [tag:colorless_tests]. | ||
NO_COLOR=true cargo-offline test | ||
test_precommit: | ||
description: Check that the provided pre-commit configuration works. | ||
dependencies: | ||
- build | ||
input_paths: | ||
- . | ||
excluded_input_paths: | ||
- .git | ||
|
||
# [tag:excluded_input_paths_1] Keep this in sync with [ref:excluded_input_paths_2] and | ||
# [ref:gitignore]. | ||
- artifacts | ||
- target | ||
command: | | ||
# Install pre-commit. | ||
pip3 install pre-commit | ||
PATH="$PATH:/home/user/.local/bin" | ||
# Set up a Git repository. | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Tagref" | ||
git config --global --add safe.directory "$PWD" | ||
git init . | ||
git add . | ||
git commit --message 'First commit!' | ||
# Create a pre-commit configuration. | ||
cat << EOF > .pre-commit-config.yaml | ||
repos: | ||
- repo: . | ||
rev: $(git rev-parse HEAD) | ||
hooks: | ||
- id: tagref | ||
EOF | ||
# Run the Tagref hook. | ||
pre-commit run tagref --all-files | ||
lint: | ||
description: Run the linters. | ||
dependencies: | ||
|
@@ -133,7 +180,8 @@ tasks: | |
excluded_input_paths: | ||
- .git | ||
|
||
# [tag:excluded_input_paths] Keep this in sync with [ref:gitignore]. | ||
# [tag:excluded_input_paths_2] Keep this in sync with [ref:excluded_input_paths_1] and | ||
# [ref:gitignore]. | ||
- artifacts | ||
- target | ||
command: | | ||
|