Skip to content

Commit

Permalink
chore: add goimports reviser pre commit hook and update tooling (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemijspavlovs authored Jun 21, 2024
1 parent 7119edb commit 892bbb4
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: 1.20.x
# go-version-file: go.mod
# - name: Run the roller installation script
# run: |
# [ -f ~/.zshrc ] && source ~/.zshrc
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ on:
workflow_dispatch:
jobs:
end_to_end_test:
runs-on: [ "arm-linux" ]
runs-on: ["arm-linux"]
env:
GOPRIVATE: "github.com/dymensionxyz/*"
GH_ACCESS_TOKEN: "${{ secrets.GH_ACCESS_TOKEN }}"
ROLLER_CONFIG_PATH: "${{ github.workspace }}/tmp/e2e_roller_config" # Setting the environment variable
ROLLER_CONFIG_PATH: "${{ github.workspace }}/tmp/e2e_roller_config" # Setting the environment variable
ROLLAPP_ID: "endtoend_1-${{ github.run_number }}"
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.10
go-version-file: go.mod
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/

- name: Init a local rollapp within screen
run: |
# Start a new detached screen session named "rollapp_init"
Expand All @@ -32,37 +31,31 @@ jobs:
# Kill the screen session after the command is done
screen -S rollapp_init -X quit
- name: Run the local hub
run: |
screen -dmS hub-session /usr/local/bin/dymd start --home "$ROLLER_CONFIG_PATH/local-hub"
sleep 5
HUB_PID=$(pgrep -f 'dymd start --home' | head -n 1)
echo "Captured PID: $HUB_PID"
echo "HUB_PID=$HUB_PID" >> $GITHUB_ENV
- name: Fund the RollApp addresses
run: |
HUB_SEQ_ADDR=$(go run . keys list --home $ROLLER_CONFIG_PATH --output json | jq -r '.hub_sequencer')
echo "HUB_SEQ_ADDR=$HUB_SEQ_ADDR" >> $GITHUB_ENV
RELAYER_ROLLAPP_ADDR=$(go run . keys list --home $ROLLER_CONFIG_PATH --output json | jq -r '."relayer-hub-key"')
/usr/local/bin/dymd tx bank multi-send local-user $HUB_SEQ_ADDR $RELAYER_ROLLAPP_ADDR 1adym --yes -b block --keyring-backend test --home $ROLLER_CONFIG_PATH/local-hub --node http://127.0.0.1:36657
sleep 10
- name: Register the rollapp
run: |
go run . tx register --home $ROLLER_CONFIG_PATH --no-output
- name: Run the rollapp
run: |
go run . run --home $ROLLER_CONFIG_PATH --no-output &
echo "ROLLAPP_PID=$!" >> $GITHUB_ENV
- name: Execute IBC relay tester
run: |
chmod +x ./scripts/ibc_relay_tester.sh
DEST_ADDR=$HUB_SEQ_ADDR ROLLAPP_ID=$ROLLAPP_ID ROLLER_CONFIG_PATH=$ROLLER_CONFIG_PATH ./scripts/ibc_relay_tester.sh 2> script_errors.log
- name: Terminate the rollapp
if: always()
run: |
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ on:
- v*
branches:
- main
paths:
- '**/*.go'
- go.mod
- go.sum
pull_request:
paths:
- '**/*.go'
- go.mod
- go.sum
jobs:
golangci-lint:
name: lint
Expand All @@ -14,23 +22,14 @@ jobs:
GOPRIVATE: "github.com/dymensionxyz/*"
GH_ACCESS_TOKEN: "${{ secrets.GH_ACCESS_TOKEN }}"
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.59.1
only-new-issues: true
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: markdownlint-cli
uses: nosborn/[email protected]
with:
files: .
config-file: .markdownlint.yaml
18 changes: 18 additions & 0 deletions .github/workflows/markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Linters
on:
push:
paths:
- '**/*.md'
pull_request:
paths:
- '**/*.md'
jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: markdownlint-cli
uses: nosborn/[email protected]
with:
files: .
config-file: .markdownlint.yaml
7 changes: 4 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
if: steps.release-please.outputs.release_created
with:
go-version-file: go.mod
Expand All @@ -51,10 +51,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
if: steps.release-please.outputs.release_created
# TODO: handle GCP, AWS, GitHub, Docker Hub and Azure container registries
- name: Run GoReleaser - release binaries
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@v6
with:
args: release --rm-dist --config .goreleaser.yaml --debug
args: release --clean --config .goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOPRIVATE: github.com/${{ env.GITHUB_REPOSITORY_OWNER }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22
go-version-file: go.mod
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- name: Build
run: make build
Expand Down
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ run:
timeout: 5m
tests: true
modules-download-mode: readonly
go: "1.22.4"
output:
# Format: colored-line-number|line-number|json|colored-tab|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity
#
Expand Down Expand Up @@ -52,7 +53,7 @@ issues:
- "^.*SA1019.*$" # Excluding SA1019 errors
linters-settings:
go-version-checker:
min-version: "1.22"
min-version: "1.22.4"
revive:
rules:
- name: exported
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
project_name: roller
before:
hooks:
Expand All @@ -16,7 +17,6 @@ builds:
- amd64
- arm64
changelog:
skip: false
use: git
groups:
- title: Features
Expand Down
16 changes: 12 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/golangci/golangci-lint
rev: v1.51.2
rev: v1.59.1
hooks:
- id: golangci-lint
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.1.1
rev: v3.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [feat, fix, ci, chore, test, docs] # optional: list of Conventional Commits types to allow e.g. [feat, fix, ci, chore, test]
- repo: local
hooks:
- id: goimports-reviser
name: go imports reviser
entry: goimports-reviser -format -recursive
language: golang
types: [go]
files: \.go$
- repo: local
hooks:
- id: golines
name: golines
entry: golines --max-len=100
entry: golines --max-len=100 -w
language: golang
types: [go]
files: \.go$

0 comments on commit 892bbb4

Please sign in to comment.