diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 8dc72ec0ff..35436223e4 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -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: ./ @@ -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 }} \ No newline at end of file