TOOLS: Fix CI 1.2 #148
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
- { | |
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 | |
- 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 --preset=conan-release | |
cmake --build --preset=conan-release | |
cmake --preset=conan-debug | |
cmake --build --preset=conan-debug | |
- name: Run the application and the tests | |
run: | | |
cd ${{ github.event.repository.name }} | |
./build/Release/src/app/CppSampleProject | |
./build/Release/test/CppSampleProjectTest | |
ctest --test-dir ./build/Release/test | |
./build/Debug/src/app/CppSampleProject | |
./build/Debug/test/CppSampleProjectTest | |
ctest --test-dir ./build/Debug/test | |
# - name: Run Valgrind | |
# if: runner.os == 'Linux' | |
# run: | | |
# cd ${{ github.event.repository.name }} | |
# sudo apt install valgrind | |
# ./run.sh setDeb | |
# ./run.sh config | |
# ./run.sh build | |
# ./run.sh valgrind | |
# ./run.sh setRel | |
# - name: Test coverage | |
# if: runner.os == 'Linux' | |
# run: | | |
# cd ${{ github.event.repository.name }} | |
# sudo apt install lcov | |
# ./run.sh testCov | |
# - name: Analyse the code | |
# run: | | |
# cd ${{ github.event.repository.name }} | |
# ./run.sh analyseCode | |
# - name: Format the code | |
# run: | | |
# cd ${{ github.event.repository.name }} | |
# ./run.sh formatCode | |
- 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 | |
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 |