2021-08-26 15:21:43 +00:00
|
|
|
name: Tests
|
2020-06-26 22:26:55 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-06-09 08:11:23 +00:00
|
|
|
- main
|
2021-08-26 15:21:43 +00:00
|
|
|
- release/**
|
2020-06-26 22:26:55 +00:00
|
|
|
|
2021-08-26 15:21:43 +00:00
|
|
|
jobs:
|
|
|
|
cleanup-runs:
|
2020-06-26 22:26:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: rokroskar/workflow-run-cleanup-action@master
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
2020-06-26 22:26:55 +00:00
|
|
|
|
2021-08-26 15:21:43 +00:00
|
|
|
install-tparse:
|
2020-06-26 22:26:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: actions/setup-go@v2.1.4
|
2021-04-17 10:00:07 +00:00
|
|
|
with:
|
2021-09-03 16:54:34 +00:00
|
|
|
go-version: 1.17
|
2021-08-26 15:21:43 +00:00
|
|
|
- name: Display Go Version
|
|
|
|
run: go version
|
|
|
|
- name: Install tparse
|
2020-06-26 22:26:55 +00:00
|
|
|
run: |
|
2021-09-05 11:03:06 +00:00
|
|
|
export GO111MODULE="on" && go get github.com/mfridman/tparse@latest
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: actions/cache@v2.1.6
|
2020-06-26 22:26:55 +00:00
|
|
|
with:
|
2021-08-26 15:21:43 +00:00
|
|
|
path: ~/go/bin
|
|
|
|
key: ${{ runner.os }}-go-tparse-binary
|
2020-06-26 22:26:55 +00:00
|
|
|
|
2021-08-26 15:21:43 +00:00
|
|
|
test-unit-cover:
|
2020-06-26 22:26:55 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: actions/setup-go@v2.1.4
|
2021-04-17 10:00:07 +00:00
|
|
|
with:
|
2021-09-03 16:54:34 +00:00
|
|
|
go-version: 1.17
|
2021-05-12 10:39:54 +00:00
|
|
|
- uses: actions/checkout@v2.3.4
|
2021-08-02 13:08:21 +00:00
|
|
|
- uses: technote-space/get-diff-action@v5
|
2020-06-26 22:26:55 +00:00
|
|
|
with:
|
2021-08-26 15:21:43 +00:00
|
|
|
PATTERNS: |
|
|
|
|
**/**.go
|
|
|
|
go.mod
|
|
|
|
go.sum
|
|
|
|
- name: Test and Create Coverage Report
|
2020-06-26 22:26:55 +00:00
|
|
|
run: |
|
2021-08-26 15:21:43 +00:00
|
|
|
make test-unit-cover
|
|
|
|
if: env.GIT_DIFF
|
2021-08-25 10:24:37 +00:00
|
|
|
- uses: codecov/codecov-action@v2.0.3
|
2020-06-26 22:26:55 +00:00
|
|
|
with:
|
|
|
|
file: ./coverage.txt
|
|
|
|
fail_ci_if_error: true
|
2021-08-26 15:21:43 +00:00
|
|
|
if: env.GIT_DIFF
|
2020-07-24 18:54:25 +00:00
|
|
|
|
2021-06-21 14:17:31 +00:00
|
|
|
# TODO: refactor before enabling
|
|
|
|
# test-importer:
|
|
|
|
# runs-on: ubuntu-latest
|
|
|
|
# timeout-minutes: 10
|
|
|
|
# steps:
|
|
|
|
# - uses: actions/checkout@v2.3.4
|
2021-08-26 15:21:43 +00:00
|
|
|
# - uses: actions/setup-go@v2.1.4
|
2021-06-21 14:17:31 +00:00
|
|
|
# with:
|
2021-09-03 16:54:34 +00:00
|
|
|
# go-version: 1.17
|
2021-08-02 13:08:21 +00:00
|
|
|
# - uses: technote-space/get-diff-action@v5
|
2021-06-21 14:17:31 +00:00
|
|
|
# id: git_diff
|
|
|
|
# with:
|
|
|
|
# SUFFIX_FILTER: |
|
|
|
|
# .go
|
|
|
|
# .mod
|
|
|
|
# .sum
|
|
|
|
# - name: test-importer
|
|
|
|
# run: |
|
|
|
|
# make test-import
|
|
|
|
# if: "env.GIT_DIFF != ''"
|
2020-09-18 16:50:08 +00:00
|
|
|
|
|
|
|
test-solidity:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
2021-05-12 10:39:54 +00:00
|
|
|
- uses: actions/checkout@v2.3.4
|
2021-08-02 13:08:21 +00:00
|
|
|
- uses: technote-space/get-diff-action@v5
|
2020-09-18 16:50:08 +00:00
|
|
|
id: git_diff
|
|
|
|
with:
|
|
|
|
SUFFIX_FILTER: |
|
|
|
|
.go
|
|
|
|
.mod
|
|
|
|
.sum
|
|
|
|
- name: test-solidity
|
|
|
|
run: |
|
|
|
|
make test-solidity
|
|
|
|
if: "env.GIT_DIFF != ''"
|
2021-08-26 15:21:43 +00:00
|
|
|
|
|
|
|
liveness-test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2.3.4
|
|
|
|
- uses: actions/setup-go@v2.1.4
|
|
|
|
with:
|
2021-09-03 16:54:34 +00:00
|
|
|
go-version: 1.17
|
2021-08-26 15:21:43 +00:00
|
|
|
- uses: technote-space/get-diff-action@v5
|
|
|
|
id: git_diff
|
|
|
|
with:
|
|
|
|
PATTERNS: |
|
|
|
|
**/**.go
|
|
|
|
go.mod
|
|
|
|
go.sum
|
|
|
|
- name: Install Starport
|
|
|
|
run: |
|
|
|
|
curl https://get.starport.network/starport! | bash
|
|
|
|
if: env.GIT_DIFF
|
|
|
|
- name: Start Local Network via Starport
|
|
|
|
run: |
|
|
|
|
starport chain serve --reset-once -v -c ./starport.yml > starport.out 2>&1 &
|
|
|
|
if: env.GIT_DIFF
|
|
|
|
- name: Test Local Network Liveness
|
|
|
|
run: |
|
|
|
|
sleep 2m
|
|
|
|
./contrib/scripts/test_localnet_liveness.sh 100 5 50 localhost
|
|
|
|
if: env.GIT_DIFF
|
|
|
|
|