forked from stratum-mining/stratum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
74 - Add pre-push hooks to repo and readme for instructions
- Loading branch information
1 parent
53ecd74
commit 60326cc
Showing
5 changed files
with
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
# An example hook script to verify what is about to be pushed. Called by "git | ||
# push" after it has checked the remote status, but before anything has been | ||
# pushed. If this script exits with a non-zero status nothing will be pushed. | ||
# | ||
# This hook is called with the following parameters: | ||
# | ||
# $1 -- Name of the remote to which the push is being done | ||
# $2 -- URL to which the push is being done | ||
# | ||
# If pushing without using a named remote those arguments will be equal. | ||
# | ||
# Information about the commits which are being pushed is supplied as lines to | ||
# the standard input in the form: | ||
# | ||
# <local ref> <local oid> <remote ref> <remote oid> | ||
# | ||
|
||
set -xe | ||
|
||
remote="$1" | ||
url="$2" | ||
act --job sv2_header_check --reuse -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-latest | ||
act --job fmt --reuse -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-latest | ||
act --job clippy-check --reuse -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-latest | ||
act --job ci --reuse -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:rust-latest |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Pushing to the repository | ||
The repository is hosted on GitHub. To push changes to the repository, you need to have a GitHub account and be added | ||
as a collaborator to the repository. You can then push changes to the repository. | ||
|
||
To push to the repository a pre-push hook needs to be run locally to ensure that the code is formatted correctly and | ||
tests pass. To install the pre-push hook run the following command from the root of the repo: | ||
|
||
This tells git where the githooks are located | ||
`# git config core.hooksPath .githooks` | ||
|
||
The githooks rely on the following being install beforehand: | ||
|
||
1. [act](https://github.com/nektos/act) - Github actions local runner. | ||
2. [docker](https://docs.docker.com/get-docker/) - Docker is used to run the act runner. | ||
|
||
Once these are installed the first time you try to push your source to the repo it'll run | ||
./githooks/pre-push script which executes the `sv2_header_check`, `fmt`, `clippy-lint` and `ci` jobs found in the | ||
`.github/workflows` directory. |
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