Merge pull request #3 from maherme/feature/publish_coverage_pages #55
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: CICD | |
on: push | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Install arm GNU toolchain | |
uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
- run: arm-none-eabi-gcc --version | |
- name: Compile cpputest libraries | |
run: make set-test-env QUIET="" MODE=set-test-env | |
- name: Compile project | |
run: make all QUIET="" QUIET_MAKE="" | |
- name: Upload working path as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: working-repo | |
path: . | |
unit_test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: working-repo | |
- name: Install gcovr | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcovr | |
- name: Run unitary testing | |
shell: bash | |
run: | | |
chmod +x build/test/stm32f446xx.elf | |
./build/test/stm32f446xx.elf | |
make gen-coverage MODE=test QUIET="" | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: ./build/test/coverage | |
publish_coverage: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: unit_test | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report | |
- name: Create coverage badge | |
uses: jaywcjlove/coverage-badges-cli@main | |
with: | |
style: flat | |
source: ./coverage_report.json | |
output: coverage/badges.svg | |
jsonPath: line_percent | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |