-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from status-im/ci
Add CI
- Loading branch information
Showing
10 changed files
with
221 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: CI | ||
on: | ||
push: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
timeout-minutes: 30 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: | ||
- os: linux | ||
cpu: amd64 | ||
- os: linux | ||
cpu: i386 | ||
- os: macos | ||
cpu: amd64 | ||
- os: windows | ||
cpu: amd64 | ||
nim: [1.6.16, devel] | ||
include: | ||
- target: | ||
os: linux | ||
builder: ubuntu-20.04 | ||
shell: bash | ||
- target: | ||
os: macos | ||
builder: macos-12 | ||
shell: bash | ||
- target: | ||
os: windows | ||
builder: windows-2019 | ||
shell: msys2 {0} | ||
|
||
defaults: | ||
run: | ||
shell: ${{ matrix.shell }} | ||
|
||
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.nim }})' | ||
runs-on: ${{ matrix.builder }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- uses: iffy/install-nim@v3 | ||
with: | ||
version: ${{ matrix.nim }} | ||
|
||
|
||
- name: Install deps | ||
run: | | ||
nimble install -dy | ||
- name: Run tests | ||
run: | | ||
nim --version | ||
nimble --version | ||
nimble test | ||
nim c examples/ping.nim | ||
nim c examples/pong.nim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import unittest2, chronos | ||
|
||
export unittest2, chronos | ||
|
||
template asyncTeardown*(body: untyped): untyped = | ||
teardown: | ||
waitFor(( | ||
proc() {.async, gcsafe.} = | ||
body | ||
)()) | ||
|
||
template asyncSetup*(body: untyped): untyped = | ||
setup: | ||
waitFor(( | ||
proc() {.async, gcsafe.} = | ||
body | ||
)()) | ||
|
||
template asyncTest*(name: string, body: untyped): untyped = | ||
test name: | ||
waitFor(( | ||
proc() {.async, gcsafe.} = | ||
body | ||
)()) | ||
|
||
template flakyAsyncTest*(name: string, attempts: int, body: untyped): untyped = | ||
test name: | ||
var attemptNumber = 0 | ||
while attemptNumber < attempts: | ||
let isLastAttempt = attemptNumber == attempts - 1 | ||
inc attemptNumber | ||
try: | ||
waitFor(( | ||
proc() {.async, gcsafe.} = | ||
body | ||
)()) | ||
except Exception as e: | ||
if isLastAttempt: raise e | ||
else: testStatusIMPL = TestStatus.FAILED | ||
finally: | ||
if not isLastAttempt: | ||
if testStatusIMPL == TestStatus.FAILED: | ||
# Retry | ||
testStatusIMPL = TestStatus.OK | ||
else: | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
when (NimMajor, NimMinor) < (1, 4): | ||
{.push raises: [Defect].} | ||
else: | ||
{.push raises: [].} | ||
|
||
import chronos | ||
import unittest2 | ||
export unittest2 | ||
|
||
const | ||
StreamTransportTrackerName = "stream.transport" | ||
StreamServerTrackerName = "stream.server" | ||
DgramTransportTrackerName = "datagram.transport" | ||
|
||
trackerNames = [ | ||
StreamTransportTrackerName, | ||
StreamServerTrackerName, | ||
DgramTransportTrackerName, | ||
] | ||
|
||
template asyncTest*(name: string, body: untyped): untyped = | ||
test name: | ||
waitFor((proc () {.async, gcsafe.} = body)()) | ||
|
||
iterator testTrackers*(extras: openArray[string] = []): TrackerBase = | ||
for name in trackerNames: | ||
let t = getTracker(name) | ||
if not isNil(t): yield t | ||
for name in extras: | ||
let t = getTracker(name) | ||
if not isNil(t): yield t | ||
|
||
template checkTracker*(name: string) = | ||
var tracker = getTracker(name) | ||
if tracker.isLeaked(): | ||
checkpoint tracker.dump() | ||
fail() | ||
|
||
template checkTrackers*() = | ||
for tracker in testTrackers(): | ||
if tracker.isLeaked(): | ||
checkpoint tracker.dump() | ||
fail() | ||
# Also test the GC is not fooling with us | ||
try: | ||
GC_fullCollect() | ||
except: | ||
discard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{.used.} | ||
|
||
import testdatachannel | ||
import teststun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters