Skip to content

Withdrawal flow/accounting work #74

Withdrawal flow/accounting work

Withdrawal flow/accounting work #74

Workflow file for this run

name: Tests
on:
pull_request:
env:
TAR_PATH: docker-image.tar
ARTIFACT_NAME: tar-docker-image
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run Unit Tests
run: go test -cover -coverprofile=coverage.out -race -v . ./keeper ./types/portal/ntt
- name: Generate Coverage HTML
if: always()
run: go tool cover -html coverage.out -o coverage.html
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: |
coverage.out
coverage.html
retention-days: 30
- name: Display Coverage Summary
if: always()
run: |
echo "## Unit Test Coverage" >> $GITHUB_STEP_SUMMARY
go tool cover -func=coverage.out >> $GITHUB_STEP_SUMMARY
build:
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- name: Build Docker Image
uses: strangelove-ventures/heighliner-build-action@v1.0.3
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: ${{ github.head_ref }} # source code ref
# Heighliner fork supporting Go v1.24
heighliner-owner: 'noble-assets'
heighliner-tag: 'v1.7.3'
# Heighliner chains.yaml config
chain: noble-dollar-simd
dockerfile: cosmos
build-target: make build
build-dir: simapp
binaries: |
- simapp/build/simd
- name: Publish Tarball as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.TAR_PATH }}
prepare:
needs: [unit-tests]
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Generate Matrix
id: set-matrix
run: |
# Run the command and convert its output to a JSON array
TESTS=$(cd e2e && go test -list . | grep -v "^ok " | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=${TESTS}" >> $GITHUB_OUTPUT
e2e-test:
needs:
- build
- prepare
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test: ${{fromJson(needs.prepare.outputs.matrix)}}
fail-fast: false
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Download Tarball Artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
- name: Load Docker Image
run: docker image load -i ${{ env.TAR_PATH }}
- name: Run E2E Tests
run: cd e2e && go test -race -v -timeout 15m -run ^${{ matrix.test }}$ .