Skip to content

[#258] Test outside cryptolib container. #3

[#258] Test outside cryptolib container.

[#258] Test outside cryptolib container. #3

name: CryptoLib Coverage
on:
push:
branches:
- 258-cyclomatic-complexity-and-mcdc-in-ci
pull_request:
branches:
- 258-cyclomatic-complexity-and-mcdc-in-ci
jobs:
coverage:
runs-on: ubuntu-latest
# container:
# image: ivvitc/cryptolib:20240814
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v3
# Step 2: Install dependencies
- name: Install Dependencies
run: |
apt-get update
apt-get install -y lcov gcovr libcurl4-openssl-dev libmariadb-dev libmariadb-dev-compat python3
- name: Install Python Libraries
run: pip install pycryptodome
- name: Install Libgcrypt
run: >
curl
-LS https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.50.tar.bz2
-o /tmp/libgpg-error-1.50.tar.bz2
&& tar -xjf /tmp/libgpg-error-1.50.tar.bz2 -C /tmp/
&& cd /tmp/libgpg-error-1.50
&& ./configure
&& make install
&& curl
-LS https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.11.0.tar.bz2
-o /tmp/libgcrypt-1.11.0.tar.bz2
&& tar -xjf /tmp/libgcrypt-1.11.0.tar.bz2 -C /tmp/
&& cd /tmp/libgcrypt-1.11.0
&& ./configure
&& make install
&& ldconfig
# Step 3: Build the project with coverage instrumentation
- name: Build with Coverage
working-directory: ${{github.workspace}}
run: |
export CFLAGS="-fprofile-arcs -ftest-coverage -g"
bash ${GITHUB_WORKSPACE}/support/scripts/build_internal.sh
# Step 5: Generate Coverage Report
- name: Generate Coverage Report
run: |
mkdir -p coverage
gcovr --branches --html --html-details -o coverage/coverage_report.html
gcovr --branches --xml -o coverage/coverage_report.xml
# Step 6: Upload Coverage Report as an Artifact
- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage
# # Step 7: Upload Coverage to GitHub Pages (Optional)
# - name: Deploy to GitHub Pages
# if: ${{ github.event_name == 'push' }}
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: coverage