-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (148 loc) · 5.69 KB
/
CI.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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI
on: [push, pull_request]
jobs:
Verification:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Linux",
# os: ubuntu-latest # TODO: Use it again when it will be ubuntu-24.04, Probably after October 30th , 2024
os: ubuntu-24.04
}
- {
name: "Windows",
os: windows-latest
}
steps:
- name: Clone the repo
env:
# Fake ternary syntax : ${{ condition && 'ifTrue' || 'ifFalse' }}
BRANCH: ${{ github.event_name =='pull_request' && github.head_ref || github.ref_name }}
run: |
echo "BRANCH:$BRANCH" # Linux
echo "BRANCH:%BRANCH%" # Cmd
echo "BRANCH:$Env:BRANCH" # PS
git clone --depth 1 --single-branch --branch ${{ env.BRANCH }} --no-tags https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}.git
- name: Install Conan
run: |
cd ${{ github.event.repository.name }}
pip install conan --break-system-packages
- name: Resolve the dependencies and set up the project
run: |
cd ${{ github.event.repository.name }}
cmake -P cmake/setup.cmake
- name: Test the commit message checker
if: runner.os == 'Linux'
run: |
cd ${{ github.event.repository.name }}/tools/git/hooks
./test_commit-msg
- name: Check the commit message
# on pull_request, available commit message is not found by the tried command
if: runner.os == 'Linux' && github.event_name != 'pull_request'
run: |
cd ${{ github.event.repository.name }}/tools/git/hooks
git log -1 --pretty=%B > ./commitMessage
./commit-msg ./commitMessage
rm ./commitMessage
- name: Build
run: |
cd ${{ github.event.repository.name }}
cmake -P cmake/build.cmake
cmake -P cmake/setDebug.cmake
cmake -P cmake/build.cmake
cmake -P cmake/setRelease.cmake
- name: Run the application and the tests
run: |
cd ${{ github.event.repository.name }}
cmake -P cmake/run.cmake
cmake -P cmake/test.cmake
ctest --test-dir ./build/Release/test
- name: Run Valgrind
if: runner.os == 'Linux'
run: |
cd ${{ github.event.repository.name }}
sudo apt install valgrind
cmake -P cmake/valgrind.cmake
- name: Test coverage
if: runner.os == 'Linux'
run: |
cd ${{ github.event.repository.name }}
sudo apt install lcov
cmake -P cmake/testCov.cmake
- name: Analyse the code
run: |
cd ${{ github.event.repository.name }}
cmake -P cmake/analyseCode.cmake
- name: Format the code
run: |
cd ${{ github.event.repository.name }}
cmake -P cmake/formatCode.cmake
- name: Install Doxygen on Linux
if: runner.os == 'Linux'
run: |
cd ${{ github.event.repository.name }}
sudo apt install doxygen
sudo apt install graphviz
- name: Install Doxygen on Windows
if: runner.os == 'Windows'
run: |
cd ${{ github.event.repository.name }}
choco install doxygen.install
choco install graphviz
- name: Create the document
env:
# Add full path on Windows since CMake can not see the doxygen from the PATH
CMD: ${{ runner.os == 'Windows' && '"C:\Program Files\doxygen\bin\doxygen"' || '' }}
run: |
cd ${{ github.event.repository.name }}
cmake -P cmake/doxygen.cmake ${{ env.CMD }}
- name: Check complexity
run: |
cd ${{ github.event.repository.name }}
pip install lizard --break-system-packages
cmake -P cmake/complex.cmake
- name: Upload artifacts
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
${{ github.event.repository.name }}/build/Doc/html
${{ github.event.repository.name }}/build/TestCov/CodeCoverage
${{ github.event.repository.name }}/build/codecloud.html
retention-days: 1
UploadToGHpages:
name: UploadToGHpages
if: success() && github.ref == 'refs/heads/main' # Upload only from main
needs: [Verification]
runs-on: ubuntu-latest
strategy:
fail-fast: false
permissions:
contents: write # Add to push to a branch
steps:
- name: Clone the repo
run: |
git clone --depth 1 --single-branch --branch gh-pages --no-tags https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}.git
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: artifacts
path: .
- name: Upload
run: |
cd ${{ github.event.repository.name }}
git config user.email "githubaction@users.noreply.github.com"
git config user.name "GitHub Action"
git config credential.username ${{ github.actor }}
rm -rf Doc CodeCoverage codecloud.html
mv ../Doc/html Doc
mv ../TestCov/CodeCoverage CodeCoverage
mv ../codecloud.html codecloud.html
git add Doc/ CodeCoverage/ codecloud.html
git commit --amend -m "Upload from ${{ github.sha }}" # Overwrite since the history is not needed for generated files
git push --force https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}.git