Skip to content
29 changes: 23 additions & 6 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ jobs:
tests:
env:
GO_TEST_TIMEOUT: 30m
name: "Test ${{ matrix.modules.name }}"
GO_TEST_SKIP_PACKAGES: "sei-iavl"
name: "Test ${{ matrix.modules.name }} (${{ matrix.shard }}/${{ matrix.total_shards }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
total_shards: [2]
shard: [1, 2]
modules:
- name: sei-chain
path: ./
Expand All @@ -37,21 +40,35 @@ jobs:
- name: Remove unnecessary tooling
run: |
# Remove unrelated tooling to open up more space. Without doing
# this ~80% of the available 15GiB space is already occupied.
# this ~80% of the available 15 GiB space is already occupied.
sudo rm -rf \
/usr/share/dotnet \
/usr/local/lib/android \
/opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
- name: Go test with race detector
working-directory: '${{ matrix.modules.path }}'
run: go test -race -tags='${{ matrix.modules.tags }}' -timeout='${{env.GO_TEST_TIMEOUT}}' -covermode=atomic -coverprofile=coverage.out ./...
run: |
if [ -n "$GO_TEST_SKIP_PACKAGES" ]; then
ALL_PACKAGES=$(go list ./... | grep -v -E "$GO_TEST_SKIP_PACKAGES")
else
ALL_PACKAGES=$(go list ./...)
fi

# Split packages into shards
PACKAGES=$(echo "$ALL_PACKAGES" | awk "NR % ${{ matrix.total_shards }} == ${{ matrix.shard }} - 1")

if [ -n "$PACKAGES" ]; then
go test -race -tags='${{ matrix.modules.tags }}' -timeout='${{env.GO_TEST_TIMEOUT}}' -covermode=atomic -coverprofile=coverage.out $PACKAGES
else
echo "No packages in this shard"
touch coverage.out
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: 'true'
fail_ci_if_error: 'false'
disable_search: 'true'
name: '${{ matrix.modules.name }}-coverage'
name: '${{ matrix.modules.name }}-shard-${{ matrix.shard }}-coverage'
files: ${{ matrix.modules.path }}/coverage.out
flags: ${{ matrix.modules.name }}
Loading