Skip to content

Commit

Permalink
use nsc for coverage (#2893)
Browse files Browse the repository at this point in the history

Co-authored-by: Trajan0x <[email protected]>
  • Loading branch information
trajan0x and trajan0x authored Jul 18, 2024
1 parent 2f02af4 commit bc7c012
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
36 changes: 22 additions & 14 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,14 @@ jobs:

test:
name: Go Coverage
runs-on: ${{ matrix.platform }}
runs-on: ${{ (matrix.package == 'agents' || matrix.package == 'core' || matrix.package == 'tools' || contains(matrix.package, 'contrib')) && 'ubuntu-latest' || 'namespace-profile-default-coverage-runner' }}
if: ${{ needs.changes.outputs.package_count_deps > 0 && (github.event_name != 'push' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) }}
needs: changes
strategy:
fail-fast: false
max-parallel: 8
matrix:
go-version:
- 1.22.x
platform:
- ubuntu-latest
# only do on agents for now. Anything that relies on solidity in a package should do this
package: ${{ fromJSON(needs.changes.outputs.packages_deps) }}
services:
Expand All @@ -112,6 +109,7 @@ jobs:

- name: Go modules cache
uses: actions/cache@v4
if: ${{ !contains(runner.name, 'nsc') }}
with:
# see https://github.com/mvdan/github-actions-golang
# also: https://glebbahmutov.com/blog/do-not-let-npm-cache-snowball/ w/ go build (workaround now is having a cache that just gets expired at night)
Expand All @@ -128,6 +126,14 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: ${{ contains(runner.name, 'nsc') && 'false' || 'true' }}

# TODO: consider setting up cache key, see: https://discord.com/channels/975088590705012777/1263347501721714793/1263534719954452560
- name: Setup Go cache
uses: namespacelabs/nscloud-cache-action@v1
if: ${{ contains(runner.name, 'nsc') }}
with:
cache: go

- name: Verify MariaDB connection
env:
Expand Down Expand Up @@ -201,7 +207,7 @@ jobs:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: password
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
GOMEMLIMIT: 3GiB
GOMEMLIMIT: 8GiB
GOGC: -1
ETHEREUM_RPC_URI: ${{ secrets.ETHEREUM_RPC_URI }}
GOPROXY: https://proxy.golang.org
Expand All @@ -220,15 +226,19 @@ jobs:
uses: jwalton/gh-docker-logs@v2
with:
dest: '/tmp/logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz /tmp/logs

- name: Replace forward slashes with dashes
id: replace
run: echo "::set-output name=package_name::$(echo ${{ matrix.package }} | sed 's/\//-/g')"
shell: bash


- name: Upload logs to GitHub
if: failure()
# if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{matrix.package}}-logs.tgz
path: ./logs.tgz
name: ${{ steps.replace.outputs.package_name }}
path: /tmp/logs/**

- name: Send Coverage (Codecov)
uses: Wandalen/[email protected]
Expand All @@ -254,8 +264,6 @@ jobs:
matrix:
go-version:
- 1.22.x
platform:
- ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -489,7 +497,7 @@ jobs:
if: ${{ github.event_name != 'push' && needs.changes.outputs.package_count_deps > 0 }}
strategy:
fail-fast: false
max-parallel: 8
max-parallel: 12
matrix:
# only do on agents for now. Anything that relies on solidity in a package should do this
package: ${{ fromJSON(needs.changes.outputs.packages_deps) }}
Expand Down
1 change: 1 addition & 0 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ root
├── <a href="./testsuite">testsuite</a>: Provides a wrapper around testify/suite.
├── <a href="./threaditer">threaditer</a>: Provides a thread-safe generic iterator for a slice.
</pre>

3 changes: 2 additions & 1 deletion core/processlog/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ func makeRawArgs(opts []StdStreamLogArgsOption) *stdStreamLogArgs {
args.LogFileName = "test"
args.LogFrequency = time.Second
// not a problem unless it's missing from user too, we'll validate at the end
args.LogDir, _ = os.MkdirTemp("", "")
args.LogDir, _ = os.MkdirTemp("/tmp/logs", "")
_ = os.MkdirAll("/tmp/logs", os.ModePerm)

args.LogFileName = "log"
args.PrintFunc = func(s []byte) {
Expand Down
5 changes: 5 additions & 0 deletions docker/goreleaser/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ RUN apt-get update && apt-get install -y nodejs
RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin

RUN rm -rf /var/lib/apt/lists/* /var/log/apt/* /tmp/* /var/tmp/*


RUN curl -fsSL https://get.namespace.so/cloud/install.sh | NS_ROOT=/usr/local sh && exit 0
ENV NS_ROOT=/usr/local/bin
ENV PATH=${PATH}:/usr/local/bin
2 changes: 1 addition & 1 deletion ethergo/backends/anvil/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewAnvilOptionBuilder() *OptionBuilder {
// set default non-anvil values
optionsBuilder.SetMaxWaitTime(time.Minute * 2)
optionsBuilder.SetRestartPolicy(Autoremove)
optionsBuilder.SetExpirySeconds(600)
optionsBuilder.SetExpirySeconds(900)

optionsBuilder.SetAccounts(10)
optionsBuilder.SetBlockTime(0)
Expand Down

0 comments on commit bc7c012

Please sign in to comment.