Skip to content

Commit

Permalink
ci: Add setup script and git push hooks (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdv2429 authored May 20, 2024
1 parent 134e05f commit 6f1c2cd
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh
# pre-push hook script

# Ensure golangci-lint is installed
if ! command -v golangci-lint >/dev/null 2>&1; then
echo "golangci-lint is not installed. Please install it with 'go install github.com/golangci/golangci-lint/cmd/[email protected]'"
exit 1
fi

# Ensure markdownlint is installed
if ! command -v markdownlint >/dev/null 2>&1; then
echo "markdownlint-cli is not installed. Please install it with 'npm install -g markdownlint-cli'"
exit 1
fi

# Run golangci-lint
golangci-lint run

# Capture the exit status of golangci-lint
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "golangci-lint checks failed. Aborting push."
exit 1
fi

# Run markdownlint
markdownlint . --config .markdownlint.yaml

# Capture the exit status of markdownlint
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "markdownlint checks failed. Aborting push."
exit 1
fi

# If all tests pass, allow the push to proceed
exit 0
14 changes: 12 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ This guide will walk you through the steps required to set up and run a Dymensio
- [Initializing `dymd`](#initializing-dymd)
- [Running the Chain](#running-the-chain)
- [Bootstrapping liquidity pools](#bootstrapping-liquidity-pools)
- [Debugging Dymension container with Devel](#debugging-dymension-container-with-devel)
- [Adding incentives](#adding-incentives)
- [Creating incentives streams](#creating-incentives-streams)
- [Locking tokens](#locking-tokens)
- [check rewards](#check-rewards)
- [Debugging Container](#debugging-container)
- [Developer](#developer)
- [Setup push hooks](#setup-push-hooks)

## Prerequisites

Expand Down Expand Up @@ -211,6 +213,14 @@ func (q Querier) Params(goCtx context.Context, req *types.QueryParamsRequest) (*

Open your browser and go to `http://localhost:1318/dymensionxyz/dymension/eibc/params` and you will see debugger stop and print the value at the breakpoint.

---
## Developer

For support, join our [Discord](http://discord.gg/dymension) community and find us in the Developer section.

### Setup push hooks

To setup push hooks, run the following command:

```sh
./scripts/setup_push_hooks.sh
```
9 changes: 9 additions & 0 deletions scripts/setup-git-hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

# Copy pre-push hook to .git/hooks/
cp ./.githooks/pre-push ./.git/hooks/pre-push

# Make the pre-push hook executable
chmod +x .git/hooks/pre-push

echo "Git push hooks installed successfully."

0 comments on commit 6f1c2cd

Please sign in to comment.