Skip to content

Dev co

Dev co #54

Workflow file for this run

name: ubuntu
on:
pull_request:
paths:
- 'sese/**'
- 'CMakeLists.txt'
- 'vcpkg.json'
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VCPKG_FEATURE_FLAGS: dependencygraph
jobs:
test:
runs-on: ubuntu-22.04
services:
mariadb:
image: mariadb
env:
MARIADB_ROOT_HOST: '%'
MARIADB_USER: libsese
MARIADB_PASSWORD: libsese
MARIADB_ROOT_PASSWORD: libsese
ports:
- '127.0.0.1:18806:3306'
postgresql:
image: postgres
env:
POSTGRES_PASSWORD: libsese
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- '127.0.0.1:18080:5432'
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
- name: Setup Database
working-directory: ${{ github.workspace }}
env:
PGPASSWORD: libsese
run: |
mysql -uroot -plibsese -h 127.0.0.1 -P 18806 < ./scripts/mysql_dump.sql
psql -U postgres -d postgres -h 127.0.0.1 -p 18080 -f ./scripts/postgres_dump.sql
mkdir build
sqlite3 build/db_test.db < scripts/sqlite_dump.sql
- name: Setup Python
uses: actions/setup-python@v5.3.0
with:
python-version: '3.11'
cache: 'pip'
- name: Setup Python Venv
run: |
python -m venv venv
source venv/bin/activate
pip install -r ${{ github.workspace }}/requirements.txt
- name: Download h2spec
run: |
wget https://github.com/summerwind/h2spec/releases/download/v2.6.0/h2spec_linux_amd64.tar.gz
tar -xzf h2spec_linux_amd64.tar.gz
- name: Restore Vcpkg Cache
id: restore-cache
uses: actions/cache/restore@v4.1.2
with:
path: ${{ github.workspace }}/vcpkg-archive
key: ${{ runner.os }}-vcpkg
- name: Configure CMake
working-directory: ${{ github.workspace }}
env:
VCPKG_ROOT: /usr/local/share/vcpkg
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-archive
Python3_ROOT_DIR: ${{ github.workspace }}/venv
run: >
source venv/bin/activate &&
mkdir -p vcpkg-archive &&
cmake
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
-DSESE_BUILD_TEST=ON
-DSESE_USE_ARCHIVE=ON
-DSESE_DB_USE_MARIADB=ON
-DSESE_DB_USE_POSTGRES=ON
-DSESE_DB_MYSQL_CONNECTION_STRING="host=127.0.0.1\;port=18806\;user=root\;pwd=libsese\;db=db_test\;"
-DSESE_DB_PSQL_CONNECTION_STRING="host=127.0.0.1\;port=18080\;user=postgres\;pwd=libsese\;db=db_test\;"
-DSESE_DB_SQLITE_CONNECTION_STRING="${{ github.workspace }}/build/db_test.db"
-DCMAKE_CXX_FLAGS="--coverage -fprofile-update=atomic"
-Bbuild
- name: Always Save Cache
if: always() && steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4.1.2
with:
path: ${{ github.workspace }}/vcpkg-archive
key: ${{ runner.os }}-vcpkg
- name: Build
working-directory: ${{ github.workspace }}
run: cmake --build build -- -j 2
- name: Test
working-directory: ${{ github.workspace }}
run: |
source venv/bin/activate
build/sese/test/AllTestsInMain --gtest_output="xml:build/test_report.xml"
- name: Test report
if: always()
run: |
npx junit-to-ctrf ./build/test_report.xml -o ./build/ctrf-report.json
npx github-actions-ctrf ./build/ctrf-report.json
- name: Coverage
working-directory: ${{ github.workspace }}
run: |
source venv/bin/activate
mkdir -p build/coverage/html
# Reports are not generated properly due to h2spec or unknown environmental reasons
# junit2html h2spec_report.xml build/coverage/h2spec.html
gcovr
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: build/coverage/coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ${{ github.workspace }}/build/coverage