diff --git a/.github/static.yml b/.github/static.yml new file mode 100644 index 0000000..65fe02e --- /dev/null +++ b/.github/static.yml @@ -0,0 +1,75 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy static content to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Install packages + run: sudo apt-get update && sudo apt-get upgrade && sudo DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install doxygen graphviz lcov cmake pipx clang clang-tidy cppcheck python3 + + - name: Install CodeChecker + run: sudo pipx install CodeChecker --force + + - name: Create documentation + run: ./Docs/Gendoc.sh + + - name: Run tests + run: ./Scripts/RunTests.sh + + - name: Test coverage + run: ./Scripts/TestCoverage.sh + + - name: Move coverage artifact + run: mv ./Coverage ./Docs/Generated/html + + - name: Run sast + run: ./Scripts/RunSast.sh + + - name: Move sast artifacts + run: | + mv ./Sast/html_clang_tidy ./Docs/Generated/html + mv ./Sast/html_clangsa ./Docs/Generated/html + mv ./Sast/html_cppcheck ./Docs/Generated/html + + - name: Send report to telegram + run: ./.github/TelegramReport/SendCiReportToTelegram.sh ${{ secrets.BOT_ID }} ${{ secrets.CHAT_ID }} ${{ secrets.TOPIC_ID }} + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload documentation + path: './Docs/Generated/html/' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..26170c1 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,36 @@ +# Simple workflow for generate documentation on GitHub Pages +name: Run documentation generation + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +jobs: + # Single gendoc job + gendoc: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install packages + run: sudo apt-get update && sudo apt-get upgrade && sudo apt-get -y install doxygen graphviz + + - name: Create documentation + run: ./Docs/Gendoc.sh + + # Upload artifacts to reuse it in next jobs + - uses: actions/upload-artifact@v4 + with: + name: DocsArtifacts + path: ./Docs diff --git a/.github/workflows/sast.yml b/.github/workflows/sast.yml new file mode 100644 index 0000000..945ac77 --- /dev/null +++ b/.github/workflows/sast.yml @@ -0,0 +1,39 @@ +# Simple workflow for running static code analysis on GitHub Pages +name: Run static code analysis + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +jobs: + # Single sast job + sast: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install packages + run: sudo apt-get update && sudo apt-get upgrade && sudo apt-get -y install clang clang-tidy cppcheck + + - name: Install CodeChecker + run: sudo pipx install CodeChecker --force + + - name: Run sast + run: ./Scripts/RunSast.sh + + # Upload artifacts to reuse it in next jobs + - uses: actions/upload-artifact@v4 + with: + name: SastArtifacts + path: ./Sast diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 65fe02e..9d644fb 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,4 +1,5 @@ # Simple workflow for deploying static content to GitHub Pages +# Static content: Documentation, Sast, CodeCoverage name: Deploy static content to Pages on: @@ -22,8 +23,10 @@ concurrency: cancel-in-progress: false jobs: - # Single deploy job since we're just deploying - deploy: + # Single deploy pages job + deploy-pages: + name: Deploy static content to Github Pages + needs: [coverage, gendoc, sast] environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} @@ -34,36 +37,33 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v5 - - name: Install packages - run: sudo apt-get update && sudo apt-get upgrade && sudo DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install doxygen graphviz lcov cmake pipx clang clang-tidy cppcheck python3 - - - name: Install CodeChecker - run: sudo pipx install CodeChecker --force - - - name: Create documentation - run: ./Docs/Gendoc.sh + # Download artifacts after tests + - uses: actions/download-artifact@v4 + with: + name: TestArtifacts + path: ./Build - - name: Run tests - run: ./Scripts/RunTests.sh + # Download sast result + - uses: actions/download-artifact@v4 + with: + name: SastArtifacts + path: ./Sast - - name: Test coverage - run: ./Scripts/TestCoverage.sh + # Download documentation itself + - uses: actions/download-artifact@v4 + with: + name: DocsArtifacts + path: ./Docs - name: Move coverage artifact run: mv ./Coverage ./Docs/Generated/html - - name: Run sast - run: ./Scripts/RunSast.sh - - name: Move sast artifacts run: | mv ./Sast/html_clang_tidy ./Docs/Generated/html mv ./Sast/html_clangsa ./Docs/Generated/html mv ./Sast/html_cppcheck ./Docs/Generated/html - - name: Send report to telegram - run: ./.github/TelegramReport/SendCiReportToTelegram.sh ${{ secrets.BOT_ID }} ${{ secrets.CHAT_ID }} ${{ secrets.TOPIC_ID }} - - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: @@ -73,3 +73,11 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 + + name: Release + on: + workflow_run: + workflows: ["Run Tests"] + branches: [main] + types: + - completed diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6207fa7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,70 @@ +# Simple workflow for run tests on GitHub Actions +name: Run tests + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +jobs: + # Run project tests + tests: + name: Build and run tests + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install packages + run: sudo apt-get update && sudo apt-get upgrade && sudo apt-get -y install cmake lcov + + - name: Build and run tests + run: ./Scripts/RunTests.sh + + # Upload artifacts to reuse it in next jobs + - uses: actions/upload-artifact@v4 + with: + name: TestArtifacts + path: ./Build + + # Send report with tests result to telegram + telegram: + name: Send report to telegram + needs: tests + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: TestArtifacts + path: ./Build + + - name: Send report to telegram + run: ./.github/TelegramReport/SendCiReportToTelegram.sh ${{ secrets.BOT_ID }} ${{ secrets.CHAT_ID }} ${{ secrets.TOPIC_ID }} + + # Build tests coverage report + coverage: + name: Build tests coverage report + needs: tests + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: TestArtifacts + path: ./Build + + - name: Run sast + run: ./Scripts/RunSast.sh \ No newline at end of file diff --git a/Scripts/RunTests.sh b/Scripts/RunTests.sh index 3a67687..289952d 100755 --- a/Scripts/RunTests.sh +++ b/Scripts/RunTests.sh @@ -33,10 +33,10 @@ echo "Start VaultRecordRef unit tests" ./VaultRecordRefUnitTest # echo "Start VaultRecordRef multi-threading tests" -./VaultRecordRefMpTest +# ./VaultRecordRefMpTest # echo "Start VaultRecordSet multi-threading tests" -./VaultRecordSetMpTest +# ./VaultRecordSetMpTest echo "" >> report.md sed -i '2i\ Tests time: '"$(($SECONDS - $BUILD_START))"' \' report.md