Skip to content

Commit

Permalink
fix(lint): shell lint
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian committed Sep 30, 2024
1 parent dce81bf commit 19494f9
Show file tree
Hide file tree
Showing 8 changed files with 211 additions and 155 deletions.
15 changes: 15 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ if ! has readlink; then
exit 1
fi

if ! has pv; then
echo "pv is not installed"
exit 1
fi

if ! has lz4; then
echo "lz4 is not installed"
exit 1
fi

if ! has git-cliff; then
echo "git-cliff is not installed"
exit 1
fi

if [ -z "$GOPATH" ]; then
GOPATH=$(go env GOPATH)
export GOPATH
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install dependencies
run: ./script/tools.sh gha-deps
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand Down Expand Up @@ -47,7 +49,7 @@ jobs:
# using PAT as homebrew is located in different repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-network-upgrade-on-release:
runs-on: upgrade-tester
runs-on: gh-runner-test
needs:
- publish
steps:
Expand All @@ -57,6 +59,12 @@ jobs:
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- uses: actions/setup-go@v5
with:
go-version: "${{ env.GOVERSION }}"
Expand All @@ -75,6 +83,7 @@ jobs:
env:
UPGRADE_BINARY_VERSION: ${{ env.RELEASE_TAG }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEST_CONFIG: test-config-gha.json
run: |
cd tests/upgrade
make test
Expand Down
66 changes: 63 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ jobs:
steps:
- name: Install dependencies
run: |
brew install bash direnv
brew install bash direnv pv lz4 git-cliff
sudo chsh -s /usr/local/bin/bash
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Hook direnv to bash
run: echo 'eval "$(direnv hook bash)"' >> $HOME/.bashrc
- uses: actions/checkout@v4
Expand All @@ -44,6 +48,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand All @@ -64,6 +74,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand All @@ -82,6 +98,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand All @@ -101,6 +123,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand All @@ -119,6 +147,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- run: git fetch --prune --unshallow
- name: Detect required Go version
run: |
Expand All @@ -140,6 +174,12 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand All @@ -165,6 +205,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand All @@ -189,14 +235,20 @@ jobs:
run: make release

network-upgrade-names:
runs-on: upgrade-tester
runs-on: ubuntu-latest
steps:
- name: Cleanup build folder
run: |
sudo rm -rf ./* || true
sudo rm -rf ./.??* || true
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- name: Detect required Go version
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
Expand All @@ -222,7 +274,7 @@ jobs:
./script/semver.sh validate "$upgrade"
done <<< $(find "$dir" ! -path "$dir" -maxdepth 1 -type d -exec basename {} \;)
network-upgrade:
runs-on: upgrade-tester
runs-on: gh-runner-test
steps:
- name: Cleanup build folder
run: |
Expand All @@ -234,6 +286,12 @@ jobs:
run: |
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
- name: Install dependencies
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils
- name: Install git-cliff
uses: baptiste0928/cargo-install@v3
with:
crate: git-cliff
- uses: actions/setup-go@v5
with:
go-version: "${{ env.GOVERSION }}"
Expand All @@ -248,6 +306,8 @@ jobs:
- name: run test
id: test
if: env.TEST_REQUIRED != ''
env:
TEST_CONFIG: test-config-gha.json
run: |
cd tests/upgrade
make test
Expand Down
30 changes: 2 additions & 28 deletions make/test-upgrade.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export AKASH_GAS = auto
export AKASH_STATESYNC_ENABLE = false
export AKASH_LOG_COLOR = true

TEST_CONFIG ?= test-config.json
KEY_OPTS := --keyring-backend=$(AKASH_KEYRING_BACKEND)
KEY_NAME ?= validator
UPGRADE_TO ?= $(shell $(ROOT_DIR)/script/upgrades.sh upgrade-from-release $(RELEASE_TAG))
Expand All @@ -37,38 +38,11 @@ test: $(COSMOVISOR) init
$(GO_TEST) -run "^\QTestUpgrade\E$$" -tags e2e.upgrade -timeout 180m -v -args \
-cosmovisor=$(COSMOVISOR) \
-workdir=$(AP_RUN_DIR)/validators \
-config=test-config.json \
-config=$(TEST_CONFIG) \
-upgrade-name=$(UPGRADE_TO) \
-upgrade-version="$(UPGRADE_BINARY_VERSION)" \
-test-cases=test-cases.json

$(COSMOVISOR_DEBUG_VERSION_FILE): $(AKASH_DEVCACHE)
@echo "installing cosmovisor for remote debug $(COSMOVISOR_VERSION) ..."
rm -f $(COSMOVISOR_DEBUG)
wget -qO- "https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor/$(COSMOVISOR_VERSION)/cosmovisor-$(COSMOVISOR_VERSION)-$(GOOS)-$(GOARCH).tar.gz" | \
tar xvz -C $(AKASH_RUN_BIN) cosmovisor
rm -rf "$(dir $@)"
mkdir -p "$(dir $@)"
touch $@
$(COSMOVISOR_DEBUG): $(COSMOVISOR_DEBUG_VERSION_FILE)

.PHONY: test-remote-prep
test-remote-prep: $(COSMOVISOR_DEBUG) bins
$(GO_TEST) -c -tags e2e.upgrade -timeout 60m \
-o $(AKASH_DEVCACHE_BIN)/upgrade.test \
-gcflags "all=-N -l" pkg.akt.dev/node/tests/upgrade
chmod +x $(AKASH_DEVCACHE_BIN)/upgrade.test
rsync -Pl $(AKASH_DEVCACHE_BIN)/upgrade.test $(REMOTE_TEST_HOST):$(REMOTE_TEST_WORKDIR)/
rsync -Prl --delete $(AKASH_RUN) $(REMOTE_TEST_HOST):$(REMOTE_TEST_WORKDIR)/
rsync -Pl $(AKASH_ROOT)/tests/upgrade/test-config.json $(REMOTE_TEST_HOST):$(REMOTE_TEST_WORKDIR)
rsync -Pl $(AKASH_ROOT)/tests/upgrade/test-cases.json $(REMOTE_TEST_HOST):$(REMOTE_TEST_WORKDIR)

.PHONY: test-remote-start
test-remote-start:
ssh -t $(REMOTE_TEST_HOST) 'cd $(REMOTE_TEST_WORKDIR); bash -ic "\
dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./upgrade.test \
-- -test.v=test2json -test.paniconexit0 -test.run ^\QTestUpgrade\E$ -cosmovisor=$$(pwd)/bin/cosmovisor -workdir=$$(pwd)/run/upgrade/validators -config=test-config.json -upgrade-name=$(UPGRADE_TO) -upgrade-version=$(UPGRADE_BINARY_VERSION) -test-cases=test-cases.json"'

.PHONY: test-reset
test-reset:
$(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" --uto=$(UPGRADE_TO) clean
Expand Down
Loading

0 comments on commit 19494f9

Please sign in to comment.