Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroCabeza committed Jul 18, 2024
1 parent 1686eae commit 8cb351b
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 105 deletions.
60 changes: 31 additions & 29 deletions .github/workflows/base_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
pull_request:
workflow_call:
inputs:
include:
description: 'Include matrix configurations'
required: false
nim_branch:
description: 'Nim branch configurations'
required: true
type: string
default: "[]"
exclude:
Expand Down Expand Up @@ -37,52 +37,54 @@ jobs:
matrix:
platform:
- os: linux
builder: ubuntu-22.04
cpu: amd64
shell: bash
- os: linux
builder: ubuntu-22.04
cpu: i386
shell: bash
- os: macos
builder: macos-13
cpu: amd64
shell: bash
- os: windows
builder: windows-2022
cpu: amd64
shell: msys2 {0}
nim_branch:
- version: version-1-6
memory_management: refc
- version: version-2-0
memory_management: refc
# This last combination is injected via "include" in the "test_nim_devel" daily test. Also written here for clarity.
# - version: devel
# memory_management: orc
nim_branch: ${{ inputs.exclude != 0 && fromJSON(inputs.nim_branch) || fromJSON("[{'version': 'version-1-6'}, {'version': 'version-2-0'}]") }}
include:
- platform:
os: linux
builder: ubuntu-22.04
shell: bash
- platform:
os: macos
builder: macos-13
shell: bash
- platform:
os: windows
builder: windows-2022
shell: msys2 {0}ve
- nim_branch:
version: version-1-6
memory_management: refc
- nim_branch:
version: version-2-0
memory_management: refc
- nim_branch:
version: devel
memory_management: orc

# If exclude or include are defined then use their value, otherwise default to empty list (as declared on workflow_call.inputs).
# If exclude is defined then use its value, otherwise default to empty list (as declared on workflow_call.inputs).
# Reason for above is when workflow is not initiated by workflow_call, the parameters are not defined. Their value is 0 or '' (empty string).
# This relies on the value 0 meaning the parameter was not filled in.
include: ${{ inputs.include != 0 && fromJSON(inputs.include) || fromJSON('[]') }}
# exclude: ${{ inputs.exclude != 0 && fromJSON(inputs.exclude) || fromJSON('[]') }}
exclude: ${{ inputs.exclude != 0 && fromJSON(inputs.exclude) || fromJSON('[]') }}

defaults:
run:
shell: ${{ matrix.platform.shell }}

name: '${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (Nim ${{ matrix.nim_branch.version }})'
# name: '${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (Nim ${{ matrix.nim_branch.version }})'
name: '${{ matrix.platform.os }}-${{ matrix.platform.cpu }}-${{ matrix.platform.builder }}-${{ matrix.platform.shell }} (Nim ${{ matrix.nim_branch.version }}-${{ matrix.nim_branch.memory_management }})'
runs-on: ubuntu-22.04
continue-on-error: ${{ matrix.nim_branch.version == 'version-2-0' || matrix.nim_branch.version == 'devel' }}
steps:
- name: Matrix info
run: |
echo ${{ matrix.platform.os }}
echo ${{ matrix.platform.builder }}
echo ${{ matrix.platform.cpu }}
echo ${{ matrix.platform.shell }}
echo ${{ matrix.nim_branch.version }}
echo ${{ matrix.nim_branch.memory_management }}
run: ""

# - name: Checkout
# uses: actions/checkout@v4
Expand Down
98 changes: 49 additions & 49 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,60 +12,60 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
codecov:
# Improvement: Split single job into run tests, generate coverage, and upload to codecov.
name: Run coverage and upload to codecov
runs-on: ubuntu-22.04
env:
CICOV: YES
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# jobs:
# codecov:
# # Improvement: Split single job into run tests, generate coverage, and upload to codecov.
# name: Run coverage and upload to codecov
# runs-on: ubuntu-22.04
# env:
# CICOV: YES
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0

- name: Setup Nim
uses: "./.github/actions/install_nim"
with:
os: linux
cpu: amd64
shell: bash
# - name: Setup Nim
# uses: "./.github/actions/install_nim"
# with:
# os: linux
# cpu: amd64
# shell: bash

- name: Restore deps from cache
id: deps-cache
uses: actions/cache@v4
with:
path: nimbledeps
key: nimbledeps-${{ hashFiles('.pinned') }}
# - name: Restore deps from cache
# id: deps-cache
# uses: actions/cache@v4
# with:
# path: nimbledeps
# key: nimbledeps-${{ hashFiles('.pinned') }}

- name: Install deps
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }}
run: |
nimble install_pinned
# - name: Install deps
# if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }}
# run: |
# nimble install_pinned

- name: Install coverage tools and setup
run: |
sudo apt-get update
sudo apt-get install -y lcov build-essential git curl
mkdir coverage
# - name: Install coverage tools and setup
# run: |
# sudo apt-get update
# sudo apt-get install -y lcov build-essential git curl
# mkdir coverage

- name: Run coverage-enabled test suite
run: |
export NIMFLAGS="--lineDir:on --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage"
nimble testnative
nimble testpubsub
nimble testfilter
# - name: Run coverage-enabled test suite
# run: |
# export NIMFLAGS="--lineDir:on --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage"
# nimble testnative
# nimble testpubsub
# nimble testfilter

- name: Run coverage
run: |
find nimcache -name *.c -delete
lcov --capture --directory nimcache --output-file coverage/coverage.info
shopt -s globstar
ls `pwd`/libp2p/{*,**/*}.nim
lcov --extract coverage/coverage.info `pwd`/libp2p/{*,**/*}.nim --output-file coverage/coverage.f.info
genhtml coverage/coverage.f.info --output-directory coverage/output
# - name: Run coverage
# run: |
# find nimcache -name *.c -delete
# lcov --capture --directory nimcache --output-file coverage/coverage.info
# shopt -s globstar
# ls `pwd`/libp2p/{*,**/*}.nim
# lcov --extract coverage/coverage.info `pwd`/libp2p/{*,**/*}.nim --output-file coverage/coverage.f.info
# genhtml coverage/coverage.f.info --output-directory coverage/output

- name: Upload coverage to codecov
run: |
bash <(curl -s https://codecov.io/bash) -f coverage/coverage.f.info || echo "Codecov did not collect coverage reports"
# - name: Upload coverage to codecov
# run: |
# bash <(curl -s https://codecov.io/bash) -f coverage/coverage.f.info || echo "Codecov did not collect coverage reports"

54 changes: 27 additions & 27 deletions .github/workflows/interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
run-transport-interop:
name: Run transport interoperability tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build image
run: docker buildx build --load -t nim-libp2p-head -f tests/transport-interop/Dockerfile .
- name: Run tests
uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master
with:
test-filter: nim-libp2p-head
extra-versions: ${{ github.workspace }}/tests/transport-interop/version.json
# jobs:
# run-transport-interop:
# name: Run transport interoperability tests
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: docker/setup-buildx-action@v3
# - name: Build image
# run: docker buildx build --load -t nim-libp2p-head -f tests/transport-interop/Dockerfile .
# - name: Run tests
# uses: libp2p/test-plans/.github/actions/run-transport-interop-test@master
# with:
# test-filter: nim-libp2p-head
# extra-versions: ${{ github.workspace }}/tests/transport-interop/version.json

run-hole-punching-interop:
name: Run hole-punching interoperability tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build image
run: docker buildx build --load -t nim-libp2p-head -f tests/hole-punching-interop/Dockerfile .
- name: Run tests
uses: libp2p/test-plans/.github/actions/run-interop-hole-punch-test@master
with:
test-filter: nim-libp2p-head
extra-versions: ${{ github.workspace }}/tests/hole-punching-interop/version.json
# run-hole-punching-interop:
# name: Run hole-punching interoperability tests
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: docker/setup-buildx-action@v3
# - name: Build image
# run: docker buildx build --load -t nim-libp2p-head -f tests/hole-punching-interop/Dockerfile .
# - name: Run tests
# uses: libp2p/test-plans/.github/actions/run-interop-hole-punch-test@master
# with:
# test-filter: nim-libp2p-head
# extra-versions: ${{ github.workspace }}/tests/hole-punching-interop/version.json

0 comments on commit 8cb351b

Please sign in to comment.