wait for babe goroutines to complete when calling babe.Service.Close() #8119
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
on: | |
pull_request: | |
# Commented paths to avoid skipping required workflow | |
# See https://git.luolix.topmunity/t/feature-request-conditional-required-checks/16761 | |
# paths: | |
# - .github/workflows/unit-tests.yml | |
# - "**/*.go" | |
# - "chain/**" | |
# - "cmd/**" | |
# - "dot/**" | |
# - "internal/**" | |
# - "lib/**" | |
# - "pkg/**" | |
# - "tests/**" | |
# - go.mod | |
# - go.sum | |
# - Makefile | |
name: unit-tests | |
jobs: | |
unit-tests: | |
timeout-minutes: 60 | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
all_but_latest: true | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
stable: true | |
check-latest: true | |
- name: Set cache variables | |
id: go-cache-paths | |
run: | | |
echo "::set-output name=go-build::$(go env GOCACHE)" | |
echo "::set-output name=go-mod::$(go env GOMODCACHE)" | |
- uses: actions/checkout@v3 | |
- name: Go build cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go-cache-paths.outputs.go-build }} | |
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go-build | |
- name: Go modules cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go-cache-paths.outputs.go-mod }} | |
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go-mod | |
- name: Install Subkey | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0 | |
mv $HOME/.local/bin/subkey-v2.0.0 $HOME/.local/bin/subkey | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0-macos | |
mv $HOME/.local/bin/subkey-v2.0.0-macos $HOME/.local/bin/subkey | |
else | |
echo "Subkey for $RUNNER_OS is not supported" | |
exit 1 | |
fi | |
chmod +x $HOME/.local/bin/subkey | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Run devnet unit tests | |
run: | | |
cd devnet && \ | |
go test -timeout=10m ./... && \ | |
cd .. | |
- name: Run unit tests | |
run: go test -coverprofile=coverage.out -covermode=atomic -timeout=45m ./... | |
- name: Trie memory test | |
run: | | |
sed -i 's/const skip = true/const skip = false/g' ./lib/trie/mem_test.go | |
go test -run ^Test_Trie_MemoryUsage$ ./lib/trie | |
sed -i 's/const skip = false/const skip = true/g' ./lib/trie/mem_test.go | |
- name: Test - Race | |
run: make test-using-race-detector | |
- uses: codecov/codecov-action@v3.1.4 | |
with: | |
if_ci_failed: success | |
informational: true | |
files: ./coverage.out | |
flags: unit-tests | |
name: coverage | |
verbose: true |