Skip to content

docs: Make the changelog user friendly (#13) #21

docs: Make the changelog user friendly (#13)

docs: Make the changelog user friendly (#13) #21

Workflow file for this run

name: CI (c++) Build and Test
on:
workflow_dispatch:
push:
branches: [ main, next ]
pull_request:
branches: [ main, next ]
defaults:
run:
shell: bash
env:
HUSKY: 0
MOCK_PATH: ${{ github.workspace }}/mock-firebolt
MOCK_SHA1SUM: cf0c4b35b5f3997bd9e6f82a18d57eafa0c62192
MOCK_PATCH: ${{ github.workspace }}/.github/mock-firebolt/events.patch
jobs:
build_docker:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.meta.outputs.tags }}
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/firebolt-client-ci
tags: type=sha
- name: Checkout Code
uses: actions/checkout@v4
- name: Get Transport Version for Build-Arg
id: transport_version
run: echo "version=$(cat ${{ github.workspace }}/.transport.version)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: .github/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args:
DEPS_TRANSPORT_V=${{ steps.transport_version.outputs.version }}
cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
format_check:
permissions:
contents: read
packages: read
needs: [build_docker]
runs-on: ubuntu-latest
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Code
uses: actions/checkout@v4
- name: Run clang-format check
run: |
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& git ls-files -- '*.cpp' '*.h' | xargs clang-format --dry-run --Werror \
"
build_project:
permissions:
contents: read
packages: read
needs: [build_docker]
runs-on: ubuntu-latest
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version
run: |
VERSION=$(git describe --tags --dirty --match "v[0-9]*")
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version: $VERSION"
- name: Configure Project
run: |
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_TESTS=ON \
&& cp firebolt-open-rpc.json build/test/ \
"
- name: Build Project
run: |
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& cmake --build build --parallel \
"
- name: Upload build directory
uses: actions/upload-artifact@v4
with:
name: build-dir
path: ${{ github.workspace }}/build
unit_tests:
permissions:
contents: read
packages: read
needs: [build_docker, build_project]
runs-on: ubuntu-latest
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Code
uses: actions/checkout@v4
- name: Download build directory
uses: actions/download-artifact@v4
with:
name: build-dir
path: ${{ github.workspace }}/build
- name: Run Unit Tests
run: |
chmod +x ${{ github.workspace }}/build/test/FireboltClientUnitTests
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& ctest --test-dir build/test \
"
- name: Generate Coverage Report
run: |
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& cd build \
&& mkdir -p coverage \
&& gcovr -r .. \
--exclude '.*/test/.*\.h' \
--exclude '.*/test/.*\.cpp' \
--decisions \
--medium-threshold 50 --high-threshold 75 \
--html-details coverage/index.html \
--cobertura coverage.cobertura.xml \
"
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ${{ github.workspace }}/build/coverage/
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: build/coverage.cobertura.xml
badge: true
hide_complexity: true
format: markdown
output: both
thresholds: "50 75"
fail_below_min: false
- name: Add coverage summary to job summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
component_tests:
permissions:
contents: read
packages: read
needs: [build_docker, build_project]
runs-on: ubuntu-latest
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Code
uses: actions/checkout@v4
- name: Download build directory
uses: actions/download-artifact@v4
with:
name: build-dir
path: ${{ github.workspace }}/build
- name: Setup Mock-Firebolt
id: setup-mock
uses: ./.github/actions/setup-mock
- name: Restore Mock-Firebolt Cache
uses: actions/cache@v4
with:
path: ${{ env.MOCK_PATH }}
key: ${{ runner.os }}-mock-${{ steps.setup-mock.outputs.deps_cache_key }}
- name: Run Component Tests
run: |
chmod +x ${{ github.workspace }}/build/test/FireboltClientComponentTests
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace -v ${{ env.MOCK_PATH }}:/mock ${{ needs.build_docker.outputs.image_tag }} \
./.github/scripts/run-component-tests.sh \
--mock /mock \
--config /workspace/.github/mock-firebolt/config.json \
--openrpc /workspace/firebolt-open-rpc.json \
--app-openrpc /workspace/.github/openrpc/firebolt-app-open-rpc.json \
--test-exe /workspace/build/test/FireboltClientComponentTests