Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroCabeza committed Jul 30, 2024
1 parent ae15941 commit 8f5855a
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 142 deletions.
150 changes: 75 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,86 +11,86 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
platform:
- os: linux
cpu: amd64
- os: linux
cpu: i386
- os: macos
cpu: amd64
- os: windows
cpu: amd64
nim:
- branch: version-1-6
memory_management: refc
- branch: version-2-0
memory_management: refc
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}
# jobs:
# test:
# timeout-minutes: 90
# strategy:
# fail-fast: false
# matrix:
# platform:
# - os: linux
# cpu: amd64
# - os: linux
# cpu: i386
# - os: macos
# cpu: amd64
# - os: windows
# cpu: amd64
# nim:
# - branch: version-1-6
# memory_management: refc
# - branch: version-2-0
# memory_management: refc
# 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}

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

name: '${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (Nim ${{ matrix.nim.branch }})'
runs-on: ${{ matrix.builder }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
# name: '${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (Nim ${{ matrix.nim.branch }})'
# runs-on: ${{ matrix.builder }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# submodules: true

- name: Setup Nim
uses: "./.github/actions/install_nim"
with:
os: ${{ matrix.platform.os }}
cpu: ${{ matrix.platform.cpu }}
shell: ${{ matrix.shell }}
nim_branch: ${{ matrix.nim.branch }}
# - name: Setup Nim
# uses: "./.github/actions/install_nim"
# with:
# os: ${{ matrix.platform.os }}
# cpu: ${{ matrix.platform.cpu }}
# shell: ${{ matrix.shell }}
# nim_branch: ${{ matrix.nim.branch }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.15.5'
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: '~1.15.5'

- name: Install p2pd
run: |
V=1 bash scripts/build_p2pd.sh p2pdCache 124530a3
# - name: Install p2pd
# run: |
# V=1 bash scripts/build_p2pd.sh p2pdCache 124530a3

- name: Restore deps from cache
id: deps-cache
uses: actions/cache@v3
with:
path: nimbledeps
# Nim branch is used as a simple way to differentiate between nimble using the "pkgs" or "pkgs2" directories.
# The change happened on Nimble v0.14.0.
key: nimbledeps-${{ matrix.nim.branch }}-${{ hashFiles('.pinned') }}
# - name: Restore deps from cache
# id: deps-cache
# uses: actions/cache@v3
# with:
# path: nimbledeps
# # Nim branch is used as a simple way to differentiate between nimble using the "pkgs" or "pkgs2" directories.
# # The change happened on Nimble v0.14.0.
# key: nimbledeps-${{ matrix.nim.branch }}-${{ 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: Run tests
run: |
nim --version
nimble --version
NIMFLAGS="${NIMFLAGS} --mm:${{ matrix.nim.memory_management }}"
nimble test
# - name: Run tests
# run: |
# nim --version
# nimble --version
# NIMFLAGS="${NIMFLAGS} --mm:${{ matrix.nim.memory_management }}"
# nimble test
96 changes: 48 additions & 48 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,58 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
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:
# 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: Setup coverage
run: |
sudo apt-get update
sudo apt-get install -y lcov build-essential git curl
mkdir coverage
# - name: Setup coverage
# run: |
# sudo apt-get update
# sudo apt-get install -y lcov build-essential git curl
# mkdir coverage

- name: Run test suite with coverage flags
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 test suite with coverage flags
# 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"
38 changes: 19 additions & 19 deletions .github/workflows/interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ jobs:
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:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
with:
# this might remove tools that are actually needed,
# when set to "true" but frees about 6 GB
tool-cache: true
# run-hole-punching-interop:
# name: Run hole-punching interoperability tests
# runs-on: ubuntu-22.04
# steps:
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/[email protected]
# with:
# # this might remove tools that are actually needed,
# # when set to "true" but frees about 6 GB
# tool-cache: true

- 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
# - 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 8f5855a

Please sign in to comment.