Skip to content

IMPR: Introduce version 2.0 #169

IMPR: Introduce version 2.0

IMPR: Introduce version 2.0 #169

Workflow file for this run

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