Skip to content

TOOLS: Move installation of DoxyGen into a CI task #110

TOOLS: Move installation of DoxyGen into a CI task

TOOLS: Move installation of DoxyGen into a CI task #110

Workflow file for this run

name: CI
on: [push, pull_request]
defaults:
run:
shell: bash
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: Create the Projects directory
run: mkdir Projects
- name: Clone the repo
run: |
BRANCH=${{ github.ref_name }}
if [ ${{ github.event_name }} = 'pull_request' ]; then
BRANCH=${{ github.head_ref }}
fi
echo "BRANCH:$BRANCH"
git clone --depth 1 --single-branch --branch $BRANCH --no-tags https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}.git Projects/${{ github.event.repository.name }}
- name: Resolve the dependencies
run: |
cd Projects/${{ github.event.repository.name }}
./run.sh deps
- name: Set up the project
run: |
cd Projects/${{ github.event.repository.name }}
./run.sh setup
- name: Test the commit message checker
if: runner.os == 'Linux'
run: |
cd Projects/${{ 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 Projects/${{ github.event.repository.name }}/tools/git/hooks
git log -1 --pretty=%B > ./commitMessage
./commit-msg ./commitMessage
rm ./commitMessage
- name: Build
run: |
cd Projects/${{ github.event.repository.name }}
./run.sh config
./run.sh build
- name: Run the application and the tests
run: |
cd Projects/${{ github.event.repository.name }}
./run.sh run
./run.sh test
cd ./build && ctest && cd -
- name: Run Valgrind
if: runner.os == 'Linux'
run: |
cd Projects/${{ 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 Projects/${{ github.event.repository.name }}
sudo apt install lcov
./run.sh testCov
- name: Analyse the code
run: |
cd Projects/${{ github.event.repository.name }}
./run.sh analyseCode
- name: Format the code
run: |
cd Projects/${{ github.event.repository.name }}
./run.sh formatCode
- name: Install Doxygen
run: |
cd Projects/${{ github.event.repository.name }}
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install doxygen
sudo apt install graphviz
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install doxygen.install
choco install graphviz
echo "/C/Program Files/doxygen/bin" >> $GITHUB_PATH
fi
- name: Create the document
run: |
cd Projects/${{ github.event.repository.name }}
./run.sh doc
- name: Check complexity
run: |
cd Projects/${{ github.event.repository.name }}
pip install lizard
./run.sh complex
- name: Upload artifacts
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
Projects/${{ github.event.repository.name }}/build/Doc/html
Projects/${{ github.event.repository.name }}/build/TestCov/CodeCoverage
Projects/${{ 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@v3
with:
name: artifacts
path: .
- name: Upload
run: |
cd ${{ github.event.repository.name }}
git config user.email "[email protected]"
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