Faster CI (#724)

* Only compile once in CI
* Fix codecov fetch
This commit is contained in:
Tanguy 2022-07-01 20:20:42 +02:00 committed by GitHub
parent d0523fdc9d
commit 150fafbee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 7 deletions

View File

@ -25,6 +25,8 @@ jobs:
]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run
run: |
sudo apt-get update
@ -63,6 +65,8 @@ jobs:
]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run
run: |
sudo apt-get update
@ -104,6 +108,8 @@ jobs:
]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run
run: |
sudo apt-get update

View File

@ -28,16 +28,14 @@ const nimflags =
proc runTest(filename: string, verify: bool = true, sign: bool = true,
moreoptions: string = "") =
var excstr = "nim c --opt:speed -d:debug -d:libp2p_agents_metrics -d:libp2p_protobuf_metrics -d:libp2p_network_protocols_metrics -d:libp2p_mplex_metrics "
excstr.add(" -d:chronicles_sinks=textlines[stdout],json[dynamic] -d:chronicles_log_level=TRACE ")
excstr.add(" -d:chronicles_runtime_filtering=TRUE ")
excstr.add(" " & getEnv("NIMFLAGS") & " ")
excstr.add(" " & nimflags & " ")
excstr.add(" -d:libp2p_pubsub_sign=" & $sign)
excstr.add(" -d:libp2p_pubsub_verify=" & $verify)
excstr.add(" " & moreoptions & " ")
if verify and sign:
# build it with TRACE and JSON logs
exec excstr & " -d:chronicles_log_level=TRACE -d:chronicles_sinks:json" & " tests/" & filename
# build it again, to run it with less verbose logs
exec excstr & " -d:chronicles_log_level=INFO -r" & " tests/" & filename
exec excstr & " -r " & " tests/" & filename
rmFile "tests/" & filename.toExe
proc buildSample(filename: string, run = false) =

View File

@ -3,6 +3,7 @@ include ../../libp2p/protocols/pubsub/gossipsub
{.used.}
import options
import ../stublogger
import stew/byteutils
import ../../libp2p/builders
import ../../libp2p/errors

View File

@ -1,5 +1,7 @@
{.used.}
import ../stublogger
import testfloodsub,
testgossipsub,
testgossipsub2,

10
tests/stublogger.nim Normal file
View File

@ -0,0 +1,10 @@
import std/typetraits
import chronicles
when defined(chronicles_runtime_filtering):
setLogLevel(INFO)
when defaultChroniclesStream.outputs.type.arity == 1:
# Hide the json logs, they're just here to check if we compile
proc noOutput(logLevel: LogLevel, msg: LogOutputStr) = discard
defaultChroniclesStream.outputs[0].writer = noOutput

View File

@ -1,4 +1,4 @@
import chronos, unittest2, helpers
import chronos, unittest2, helpers, stublogger
import ../libp2p/daemon/daemonapi, ../libp2p/multiaddress, ../libp2p/multicodec,
../libp2p/cid, ../libp2p/multihash, ../libp2p/peerid

View File

@ -1,4 +1,4 @@
import options, tables
import options, tables, stublogger
import chronos, chronicles, stew/byteutils
import helpers
import ../libp2p

View File

@ -1,3 +1,5 @@
import stublogger
import testvarint,
testconnection,
testminprotobuf,

View File

@ -9,6 +9,7 @@
when defined(nimHasUsed): {.used.}
import unittest2
import stublogger
import ../libp2p/crypto/crypto
import nimcrypto/utils