File: formatting.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 (116 lines) | stat: -rw-r--r-- 3,189 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
name: Check formatting

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

on:
  push:
    branches: 
      - master
      - release/**
  pull_request:
    branches:
      - master
      - release/**

jobs:
  black:
    name: Python
    runs-on: ubuntu-20.04
    timeout-minutes: 5
    steps:
      - name: Set up Python@3.7
        uses: actions/setup-python@v5
        with:
          python-version: 3.7
      
      - name: Install Black
        run: |
          python -m pip install --upgrade pip
          python -m pip install --upgrade black[jupyter]==22.12.0

      - uses: actions/checkout@v4

      - name: Check Python formatting
        working-directory: ${{runner.workspace}}/nrn
        run: |
          git ls-tree -z -r HEAD --name-only \
          | grep -z '\.\(py\|ipynb\)$' \
          | xargs -0 black --check --color --diff --target-version py37

  cmake:
    name: CMake
    runs-on: ubuntu-20.04
    timeout-minutes: 5
    steps:
      - name: Set up Python@3.7
        uses: actions/setup-python@v5
        with:
          python-version: 3.7

      - name: Install cmake-format
        run: |
          python -m pip install --upgrade pip
          python -m pip install --upgrade cmake-format pyyaml

      - name: Install Ninja
        run: |
          sudo apt-get update
          sudo apt-get install ninja-build

      - uses: actions/checkout@v4

      - name: Configure
        working-directory: ${{runner.workspace}}/nrn
        run: |
          mkdir build
          cd build/
          # Need to configure the build to trigger the hpc-coding-conventions
          # YAML magic
          cmake -G Ninja .. \
            -DNRN_CMAKE_FORMAT=ON \
            -DNRN_ENABLE_RX3D=OFF \
            -DNRN_ENABLE_PYTHON=OFF \
            -DNRN_ENABLE_INTERVIEWS=OFF \
            -DNRN_ENABLE_MPI=OFF

      - name: Check CMake formatting
        working-directory: ${{runner.workspace}}/nrn/build
        run: ninja check-cmake-format

  cpp:
    name: C/C++
    runs-on: ubuntu-20.04
    timeout-minutes: 5
    steps:
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install ninja-build
          # The last .1 refers to ssciwr/clang-format-wheel#23.
          sudo pip install clang-format==12.0.1.1
          command -v clang-format
          clang-format --version

      - uses: actions/checkout@v4

      - name: Configure
        working-directory: ${{runner.workspace}}/nrn
        run: |
          mkdir build
          cd build/
          # Need to configure the build to trigger the hpc-coding-conventions
          # YAML magic. Disable as much as possible now that the list of files
          # to format is based on git ls-tree.
          cmake -G Ninja .. \
            -DClangFormat_EXECUTABLE=$(command -v clang-format) \
            -DNRN_CLANG_FORMAT=ON \
            -DNRN_ENABLE_INTERVIEWS=OFF \
            -DNRN_ENABLE_MPI=OFF \
            -DNRN_ENABLE_PYTHON=OFF \
            -DNRN_ENABLE_RX3D=OFF

      - name: Check C/C++ formatting
        working-directory: ${{runner.workspace}}/nrn/build
        run: ninja check-clang-format