[DO NOT MERGE] v6.0.4 -> v7.0 upgrade test #6887
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Protocol Build & Test | |
on: # yamllint disable-line rule:truthy | |
pull_request: | |
paths: | |
- 'protocol/**' | |
push: | |
branches: | |
- main | |
- 'release/protocol/v[0-9]+.[0-9]+.x' # e.g. release/protocol/v0.1.x | |
- 'release/protocol/v[0-9]+.x' # e.g. release/protocol/v1.x | |
paths: | |
- 'protocol/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
# Runs all unit tests and end-to-end cli tests | |
unit-end-to-end-and-integration: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./protocol | |
steps: | |
- | |
name: Check out repository code | |
uses: actions/checkout@v3 | |
- | |
name: Setup Golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- | |
name: Ensure `go.mod` is up to date | |
run: go mod tidy && git diff --exit-code | |
- | |
name: Run all tests | |
run: make test-ci | |
# Runs tests with thread race detection enabled | |
test-race: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./protocol | |
steps: | |
- | |
name: Check out repository code | |
uses: actions/checkout@v3 | |
- | |
name: Setup Golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- | |
name: Ensure `go.mod` is up to date | |
run: go mod tidy && git diff --exit-code | |
- | |
name: Run all tests | |
run: make test-race | |
# Runs only unit tests for coverage (does not include end-to-end cli tests) | |
test-coverage-upload: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./protocol | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- uses: actions/checkout@v3 | |
- name: Install goveralls | |
run: go install github.com/mattn/goveralls@latest | |
- name: build | |
run: | | |
make build | |
- name: test & coverage report creation | |
run: make test-cover | |
- 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 ./mocks -type f -name '*.go')" | |
for filename in ${excludelist}; do | |
filename=$(echo $filename | sed 's/^./github.com\/dydxprotocol\/v4/g') | |
echo "Excluding ${filename} from coverage report..." | |
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.out | |
done | |
- name: Send coverage | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: goveralls -coverprofile=coverage.out -service=github | |
liveness-test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./protocol | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22 | |
- name: Prune Docker system to free up space | |
run: | | |
docker system prune -a --volumes -f | |
- name: start localnet | |
run: | | |
DOCKER_BUILDKIT=1 make localnet-startd | |
- name: test liveness | |
run: | | |
./scripts/localnet_liveness.sh 100 5 50 localhost |