Skip to content

fix: fix hooks and add tests #1890

fix: fix hooks and add tests

fix: fix hooks and add tests #1890

Workflow file for this run

name: Test
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- main
release:
types:
- created
env:
TAR_PATH: heighliner.tar
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.21.5"
- uses: actions/checkout@v4
- name: Unit Tests
run: |
make test
env:
TEST_TARGET: "./x/..."
TEST_ARGS: "-timeout 10m -race -coverprofile=./coverage.out -covermode=atomic -v"
- name: Filter out DONTCOVER
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
excludelist+=" $(find ./ -type f -name '*.pb.go')"
excludelist+=" $(find ./ -type f -name '*.pb.gw.go')"
excludelist+=" $(find ./ -type f -path './tests/mocks/*.go')"
excludelist+=" $(find ./ -type f -path './x/lscosmos/*')"
excludelist+=" $(find ./ -type f -path './x/liquidstake/client/*')"
excludelist+=" $(find ./ -type f -path './x/liquidstakeibc/client/*')"
excludelist+=" $(find ./ -type f -path './x/ratesync/client/*')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^.\///g')
echo "Excluding ${filename} from coverage report..."
sed -i "/$(echo $filename | sed 's/\//\\\//g')/d" ./coverage.out
done
- name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1
- name: LCOV Minimum test coverage checker
uses: terencetcf/github-actions-lcov-minimum-coverage-checker@v1
with:
coverage-file: coverage.lcov
minimum-coverage: 70
- name: Coveralls
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
- name: Code Coverage Report
if: github.event_name == 'pull_request'
uses: vebr/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lcov-file: coverage.lcov
update-comment: true
build-e2e-environment:
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Build Docker image
uses: strangelove-ventures/[email protected]
with:
registry: # empty registry, image only shared for e2e testing
tag: local # emulate local environment for consistency in interchaintest cases
tar-export-path: ${{ env.TAR_PATH }} # export a tarball that can be uploaded as an artifact for the e2e jobs
platform: linux/amd64 # test runner architecture only
git-ref: ${{ steps.branch-name.outputs.current_branch }}
# Heighliner chains.yaml config
chain: pstake
dockerfile: cosmos
build-target: make install
binaries: |
- /go/bin/pstaked
build-env: |
- LEDGER_ENABLED=false
- BUILD_TAGS=muslc
# Use github actions artifacts for temporary storage of the docker image tarball
- name: Publish Tarball as Artifact
uses: actions/upload-artifact@v4
with:
name: pstake-docker-image
path: ${{ env.TAR_PATH }}
- name: Setup Go with cache
uses: magnetikonline/action-golang-cache@v4
with:
go-version: "1.21.5"
id: go
- name: Checkout repository
uses: actions/checkout@v4
- name: Download dependencies for interchaintest
run: |
cd interchaintest && go mod download
e2e-tests:
needs: build-e2e-environment
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test:
- "e2e-test-basic"
- "e2e-test-ibc-transfer"
fail-fast: false
steps:
# Load the docker image tarball from github actions artifacts and run tests (one runner per test due to matrix)
- name: Download Tarball Artifact
uses: actions/download-artifact@v4
with:
name: pstake-docker-image
- name: Load Docker Image
run: docker image load -i ${{ env.TAR_PATH }}
- name: Setup Go with cache
uses: magnetikonline/action-golang-cache@v4
with:
go-version: "1.21.5"
id: go
- name: Checkout repository
uses: actions/checkout@v4
- name: run test
run: make ${{ matrix.test }}