Skip to content

Merge pull request #14 from sakars/help-screen-update #85

Merge pull request #14 from sakars/help-screen-update

Merge pull request #14 from sakars/help-screen-update #85

name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tests:
runs-on: ubuntu-24.04
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# Set up CMake
- name: Set up CMake
uses: lukka/get-cmake@latest
# Install dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get remove -y g++-13
sudo apt-get install -y g++=4:13.2.0-7ubuntu1
- name: Install nlohmann/json
run: |
# Clone and install nlohmann/json
cd ${{ github.workspace }}
git clone https://github.com/nlohmann/json.git
cd json
mkdir build && cd build
cmake -DJSON_BuildTests=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/third_party ..
make install
cd ../..
- name: Install uriparser
run: |
# Clone and install uriparser
cd ${{ github.workspace }}
git clone https://github.com/uriparser/uriparser
cd uriparser
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DURIPARSER_BUILD_WCHAR_T=OFF -DURIPARSER_BUILD_TESTS=OFF -DURIPARSER_BUILD_DOCS=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/third_party ..
make install
cd ../..
# Configure the project
- name: Configure with CMake
run: |
cd ${{ github.workspace }}
cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{ github.workspace }}/third_party -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_COMPILER=/usr/bin/g++
# Build the output test samples
- name: Build the samples for output tests
run: cmake --build build --target full_test_samples -- -j$(nproc)
- name: Reconfigure with the new output test samples
run: |
cd ${{ github.workspace }}
cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{ github.workspace }}/third_party -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DOUTPUT_TEST_SAMPLES=ON
# Build the project
- name: Build the project
run: cmake --build build -- -j$(nproc)
# Run tests
- name: Run tests
continue-on-error: true
run: |
chmod +x ./build/tests
ctest --test-dir build --output-on-failure --output-junit test-results.xml
# Upload test results
- name: Upload test results
if: ${{ hashFiles('build/test-results.xml') != '' }}
uses: actions/upload-artifact@v4
with:
path: build/test-results.xml
name: test-results
report:
permissions:
statuses: write
checks: write
contents: write
pull-requests: write
actions: write
needs: tests
runs-on: ubuntu-24.04
steps:
- uses: dorny/test-reporter@v1
with:
artifact: test-results
name: Test Results
reporter: java-junit
path: test-results.xml