Build with Unit Tests #392
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: Build with Unit Tests | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '0 1 * * *' | |
jobs: | |
caffa: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-latest, ubuntu-22.04, ubuntu-24.04, macos-13, macos-14 ] | |
include: | |
- os: windows-latest | |
triplet: x64-windows | |
vcpkgCommitId: 'eb0f108ebd674c6ed79acb1c2e123208c416af0d' | |
- os: ubuntu-22.04 | |
vcpkgCommitId: 'eb0f108ebd674c6ed79acb1c2e123208c416af0d' | |
- os: ubuntu-24.04 | |
vcpkgCommitId: 'eb0f108ebd674c6ed79acb1c2e123208c416af0d' | |
- os: macos-13 | |
vcpkgCommitId: 'eb0f108ebd674c6ed79acb1c2e123208c416af0d' | |
- os: macos-14 | |
vcpkgCommitId: 'eb0f108ebd674c6ed79acb1c2e123208c416af0d' | |
env: | |
VCPKG_ROOT: ${{ github.workspace }}/vcpkg | |
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} | |
steps: | |
- name: Install dependencies | |
run: sudo apt-get install ninja-build googletest libgtest-dev libssl-dev | |
if: contains(matrix.os, 'ubuntu') | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: lukka/get-cmake@latest | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
if: contains(matrix.os, 'windows') | |
- name: List $RUNNER_WORKSPACE before build | |
run: find $RUNNER_WORKSPACE | |
shell: bash | |
- name: Setup VCPKG or load from cache | |
uses: lukka/run-vcpkg@v11 | |
id: runvcpkg | |
with: | |
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' | |
vcpkgGitCommitId: '${{ matrix.vcpkgCommitId}}' | |
runVcpkgInstall: true | |
vcpkgJsonGlob: '*/vcpkg.json' | |
- name: Prints output of run-vcpkg's action. | |
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " | |
- name: Configure Caffa | |
uses: lukka/run-cmake@v10.7 | |
with: | |
configurePreset: 'ninja-multi-vcpkg' | |
- name: Build Caffa | |
uses: lukka/run-cmake@v10.7 | |
with: | |
buildPreset: 'ninja-release-vcpkg' | |
- name: Run Caffa Unit Tests | |
uses: lukka/run-cmake@v10.7 | |
with: | |
testPreset: 'test-release-vcpkg' | |
- name: List $RUNNER_WORKSPACE after build | |
run: find $RUNNER_WORKSPACE | |
shell: bash | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Python modules | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools pytest requests | |
- name: Run pytest | |
run: | | |
builds/ninja-multi-vcpkg/bin/Release/caffaRestInterface_ExampleServer 50000 1 & | |
cd RestInterface/Bindings/Python/caffa | |
python -m pytest --log-cli-level=DEBUG | |
cd ../../.. | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v3 | |
- name: Build with Gradle | |
run: | | |
builds/ninja-multi-vcpkg/bin/Release/caffaRestInterface_ExampleServer 50000 1 & | |
cd RestInterface/Bindings/Java | |
gradle wrapper | |
./gradlew build | |