Skip to content

common

common #575

Workflow file for this run

name: common
on:
pull_request:
schedule:
- cron: '0 2 * * *'
env:
GO_VERSION: 1.12.15
CI_GOMAXPROCS: 0
INSOLAR_LOG_LEVEL: warn
jobs:
unit-tests:
name: unit-tests
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/mainnet/mainnet/go
steps:
- name: set nightly run params
if: github.event_name == 'schedule'
run: |
echo "::set-env name=TEST_COUNT::300"
echo "::set-env name=TEST_PARALLEL::10"
echo "::set-env name=TEST_ARGS::-race -failfast -timeout 240m"
- name: checkout code
uses: actions/checkout@master
with:
path: go/src/github.com/insolar/mainnet
- name: set up go ${{env.GO_VERSION}}
uses: actions/setup-go@v1
with:
go-version: ${{env.GO_VERSION}}
- name: add bin to path
run: echo "::add-path::${{env.GOPATH}}/bin"
- name: test_prepare
run: |
go mod download
make pre-build build
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
- name: test_unit
run: make test_unit
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
slow-tests:
name: slow-tests
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/mainnet/mainnet/go
steps:
- name: set nightly run params
if: github.event_name == 'schedule'
run: |
echo "::set-env name=TEST_COUNT::20"
echo "::set-env name=TEST_PARALLEL::1"
echo "::set-env name=TEST_ARGS::-race -timeout 240m"
- name: checkout code
uses: actions/checkout@master
with:
path: go/src/github.com/insolar/mainnet
- name: set up go ${{env.GO_VERSION}}
uses: actions/setup-go@v1
with:
go-version: ${{env.GO_VERSION}}
- name: add bin to path
run: echo "::add-path::${{env.GOPATH}}/bin"
- name: test_prepare
run: |
go mod download
make pre-build build
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
- name: test_slow
run: make test_slow
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
codegen:
name: codegen
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/mainnet/mainnet/go
steps:
- name: checkout code
uses: actions/checkout@master
with:
path: go/src/github.com/insolar/mainnet
- name: set up go ${{env.GO_VERSION}}
uses: actions/setup-go@v1
with:
go-version: ${{env.GO_VERSION}}
- name: add bin to path
run: echo "::add-path::${{env.GOPATH}}/bin"
- name: codegen
run: |
go clean -modcache
make install-deps
make pre-build
git diff --exit-code
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
coverage:
name: coverage
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/mainnet/mainnet/go
steps:
- name: checkout code
uses: actions/checkout@master
with:
path: go/src/github.com/insolar/mainnet
- name: set up go ${{env.GO_VERSION}}
uses: actions/setup-go@v1
with:
go-version: ${{env.GO_VERSION}}
- name: add bin to path
run: echo "::add-path::${{env.GOPATH}}/bin"
- name: generate codecov
run: |
make test-with-coverage
content=`cat coverage.txt | ./scripts/dev/cover-filter.sh`
echo "$content" | tee $GITHUB_WORKSPACE/coverage.txt
cat ./coverage.txt | wc
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
- name: Codecov
if: github.event_name == 'pull_request'
uses: codecov/codecov-action@v1.0.10
with:
token: ${{ secrets.codecov_token }}
file: ./coverage.txt
yml: ./codecov.yml
fail_ci_if_error: true
func-tests-badger:
runs-on: ubuntu-latest
name: func-tests-badger
env:
GOPATH: /home/runner/work/mainnet/mainnet/go
steps:
- name: set nightly run params
if: github.event_name == 'schedule'
run: |
echo "::set-env name=TEST_COUNT::50"
echo "::set-env name=TEST_PARALLEL::10"
echo "::set-env name=TEST_ARGS::-race -timeout 240m"
- name: checkout code
uses: actions/checkout@master
with:
path: go/src/github.com/insolar/mainnet
- name: set up go ${{env.GO_VERSION}}
uses: actions/setup-go@v1
with:
go-version: ${{env.GO_VERSION}}
- name: add bin to path
run: echo "::add-path::${{env.GOPATH}}/bin"
- name: test_func
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
run: |
make submodule
make build
make functest
- name: slack
if: failure()
run: curl -s ${{secrets.SLACK_URL}} -d '{"text":"Func-tests-badger failed for https://github.com/'$GITHUB_REPOSITORY'/pull/'$(echo $GITHUB_REF | cut -d '/' -f3)'\nHave a look! @'$GITHUB_ACTOR'"}'
- name: archive_logs
if: failure()
run: |
tar -czvf logs-badger.tar.gz go/src/github.com/insolar/mainnet/.artifacts/launchnet/logs
- uses: actions/upload-artifact@v1
if: failure()
with:
name: logs-badger
path: logs-badger.tar.gz
func-tests-pgsql:
runs-on: ubuntu-latest
name: func-tests-pgsql
env:
GOPATH: /home/runner/work/mainnet/mainnet/go
steps:
- name: set nightly run params
if: github.event_name == 'schedule'
run: |
echo "::set-env name=TEST_COUNT::50"
echo "::set-env name=TEST_PARALLEL::10"
echo "::set-env name=TEST_ARGS::-race -timeout 240m"
- name: checkout code
uses: actions/checkout@master
with:
path: go/src/github.com/insolar/mainnet
- name: set up go ${{env.GO_VERSION}}
uses: actions/setup-go@v1
with:
go-version: ${{env.GO_VERSION}}
- name: add bin to path
run: echo "::add-path::${{env.GOPATH}}/bin"
- name: test_func
working-directory: ${{env.GOPATH}}/src/github.com/insolar/mainnet
env:
POSTGRES_ENABLE: 1
run: |
make submodule
make build
make functest
- name: slack
if: failure()
run: curl -s ${{secrets.SLACK_URL}} -d '{"text":"Func-tests-postgresql failed for https://github.com/'$GITHUB_REPOSITORY'/pull/'$(echo $GITHUB_REF | cut -d '/' -f3)'\nHave a look! @'$GITHUB_ACTOR'"}'
- name: archive_logs
if: failure()
run: |
tar -czvf logs-pgsql.tar.gz go/src/github.com/insolar/mainnet/.artifacts/launchnet/logs
- uses: actions/upload-artifact@v1
if: failure()
with:
name: logs-pgsql
path: logs-pgsql.tar.gz