-
Notifications
You must be signed in to change notification settings - Fork 132
92 lines (87 loc) · 2.98 KB
/
formatting.yml
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
# ns-3 CI/CD script with the pre-build stage
#
# Contains jobs to check the ns-3 code formatting and spell-checking.
name: "Check code formatting"
run-name: "formatting"
on:
workflow_call:
workflow_dispatch:
jobs:
# Clang-format
check-style-clang-format:
runs-on: ubuntu-latest
container:
image: ubuntu:rolling
strategy:
matrix:
version: [14, 17]
timeout-minutes: 60
steps:
# The following step is required in all jobs that use this repo's actions
- name: "Retrieve actions from repository"
uses: actions/checkout@v4
with:
sparse-checkout: .github/actions
- name: "Install required system packages"
run: >
apt update && DEBIAN_FRONTEND=noninteractive apt install -y
python3
clang-format-${{ matrix.version }}
wget
- name: "Checkout this repository as ns-3 module"
uses: ./.github/actions/checkout-in-ns3
- name: "Check code style"
run: python3 utils/check-style-clang-format.py --verbose src/lorawan
# Emacs line
emacs-line:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- run: >
if ( egrep -rn --include="*.h" --include="*.cc" --include="*.c" --include="*.py" --include="*.rst" "c-file-style:|py-indent-offset:" ) ; then
echo "Found Emacs lines on the above C/C++, Python and RST files" ;
exit 1 ;
else
echo "No Emacs lines found on C/C++, Python and RST files" ;
exit 0 ;
fi
# Spell checking
spell-check:
runs-on: ubuntu-latest
container:
image: python:latest
timeout-minutes: 60
env:
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
steps:
- uses: actions/checkout@v4
- run: pip install codespell
# Get commit messages
- run: >
if (git remote | grep -qw upstream) ; then
git remote remove upstream ;
fi
- run: git config --global --add safe.directory $GITHUB_WORKSPACE
- run: git remote add -t $CI_DEFAULT_BRANCH --no-tags -f upstream https://github.com/signetlabdei/lorawan.git
- run: git log --pretty=%B HEAD...upstream/$CI_DEFAULT_BRANCH ^upstream/$CI_DEFAULT_BRANCH > git_messages.txt
# Check source code and commit messages
- run: codespell -f -C0 --skip="./experiments" ./
# CMake formatting
cmake-format:
runs-on: ubuntu-latest
container:
image: python:latest
timeout-minutes: 60
steps:
# The following step is required in all jobs that use this repo's actions
- name: "Retrieve actions from repository"
uses: actions/checkout@v4
with:
sparse-checkout: .github/actions
- run: pip install pyyaml cmake cmake-format ninja wget
- name: "Checkout this repository as ns-3 module"
uses: ./.github/actions/checkout-in-ns3
- run: |
./ns3 configure --enable-modules=core
./ns3 build cmake-format-check