Skip to content

feat(pkg/trie): Add inserts to TrieDB #10333

feat(pkg/trie): Add inserts to TrieDB

feat(pkg/trie): Add inserts to TrieDB #10333

Workflow file for this run

on:
pull_request:
# Commented paths to avoid skipping required workflow
# See https://github.community/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.12.1
with:
all_but_latest: true
- uses: actions/setup-go@v5
with:
go-version: "1.21"
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@v4
- name: Go build cache
uses: actions/cache@v4
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@v4
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' ./pkg/trie/inmemory/mem_test.go
go test -run ^Test_Trie_MemoryUsage$ ./pkg/trie
sed -i 's/const skip = false/const skip = true/g' ./pkg/trie/inmemory/mem_test.go
- name: Test - Race
run: make test-using-race-detector
- uses: codecov/codecov-action@v4.3.1
with:
if_ci_failed: success
informational: true
files: ./coverage.out
flags: unit-tests
name: coverage
verbose: true