File: coverage.yml

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (128 lines) | stat: -rw-r--r-- 4,930 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: NEURON Code Coverage

concurrency:
  group: ${{ github.workflow }}#${{ github.ref }}
  cancel-in-progress: true

on:
  push:
    branches:
      - master
      - release/**
  pull_request:
    branches:
      - master
      - release/**
# TODO : https://github.com/neuronsimulator/nrn/issues/1063
#    paths-ignore:
#      - '**.md'
#      - '**.rst'
#      - 'docs/**'

env:
  PY_MIN_VERSION: '3.9'
  PY_MAX_VERSION: '3.12'

jobs:
  coverage:
    runs-on: ubuntu-22.04

    name: Code Coverage

    timeout-minutes: 45

    steps:

      - name: Install apt packages
        run: |
          sudo apt-get install  build-essential doxygen lcov libopenmpi-dev libmpich-dev libx11-dev libxcomposite-dev mpich openmpi-bin patchelf gpg
        shell: bash

      - name: Setup Caliper profiler
        run: |
          git clone https://github.com/LLNL/Caliper.git
          cd Caliper
          mkdir build && cd build
          cmake ..
          make && sudo make install

      - name: Set up Python@${{ env.PY_MIN_VERSION }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.PY_MIN_VERSION }}

      - name: Set up Python@${{ env.PY_MAX_VERSION }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.PY_MAX_VERSION }}

      - uses: actions/checkout@v4
        with:
          fetch-depth: 2

      - name: Install Python@${{ env.PY_MIN_VERSION }} dependencies
        working-directory: ${{runner.workspace}}/nrn
        run: |
          python${PY_MIN_VERSION} -m pip install --upgrade pip -r nrn_requirements.txt

      - name: Install Python@${{ env.PY_MAX_VERSION }} dependencies
        working-directory: ${{runner.workspace}}/nrn
        run: |
          python${PY_MAX_VERSION} -m pip install --upgrade pip -r nrn_requirements.txt

      - name: Build & Test
        id: build-test
        shell: bash
        working-directory: ${{runner.workspace}}/nrn
        run:  |
          export SHELL="/bin/bash"

          # Compiler setup
          export CC=gcc
          export CXX=g++

          # Python setup
          export PYTHON_MIN=$(which $PYTHON_MIN_NAME);
          export PYTHON_MAX=$(which $PYTHON_MAX_NAME);

          mkdir build && cd build;

          # CMake options & flags
          export COVERAGE_FLAGS="--coverage -O0 -fno-inline -g";
          export CMAKE_OPTION="-DNRN_ENABLE_MPI=ON -DNRN_ENABLE_INTERVIEWS=ON -DNRN_ENABLE_PYTHON=ON -DNRN_ENABLE_PYTHON_DYNAMIC=ON -DNRN_PYTHON_DYNAMIC=${PYTHON_MIN};${PYTHON_MAX} -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_PROFILING=ON";
          cmake $CMAKE_OPTION -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DNRN_ENABLE_TESTS=ON -DCMAKE_C_FLAGS="${COVERAGE_FLAGS}" -DCMAKE_CXX_FLAGS="${COVERAGE_FLAGS}" ..;

          # Coverage
          # The Linux runners apparently have 2 cores, but jobs were being killed when we did not specify this explicitly.
          # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
          # By default we get a modern version of CMake that understands --parallel.
          cmake --build . --parallel 2
          (cd ..;  lcov --capture  --initial --directory . --no-external --output-file build/coverage-base.info)
          export PATH=`pwd`/bin:$PATH;
          ctest -VV;
          (cd ..; lcov --capture  --directory . --no-external --output-file build/coverage-run.info)
          lcov --add-tracefile coverage-base.info --add-tracefile coverage-run.info --output-file coverage-combined.info

          # Download codecov script and perform integrity checks
          curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import # One-time step 
          curl -Os https://uploader.codecov.io/latest/linux/codecov 
          curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM 
          curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig 
          gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM 
          shasum -a 256 -c codecov.SHA256SUM 
          chmod +x codecov 

          # Prefer auto-discovery for now. Specify reports once all python testing is unified under single report (-f option).
          ./codecov
        env:
          MATRIX_EVAL: "CC=gcc CXX=g++"
          PYTHON_MIN_NAME: "python${{ env.PY_MIN_VERSION }}"
          PYTHON_MAX_NAME: "python${{ env.PY_MAX_VERSION }}"

      # This step will set up an SSH connection on tmate.io for live debugging.
      # To enable it, you have to:
      #   * add 'live-debug-coverage' to your PR title
      #   * push something to your PR branch (note that just re-running the pipeline disregards the title update)
      - name: live debug session on failure (manual steps required, check `.github/coverage.yml`)
        if: failure() && contains(github.event.pull_request.title, 'live-debug-coverage')
        uses: mxschmitt/action-tmate@v3