Skip to content

Commit

Permalink
run unit tests when a PR is submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMcInnes authored Jul 26, 2024
1 parent 8a02be0 commit eb17eaa
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: run unit tests on the desktop build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
QT_VERSION: 6.6.1
RUN_UNIT_TESTS: ON

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Check for a cached version
uses: actions/cache@v4
id: cached_qt_emscripten
with:
path: |
/opt/hostedtoolcache
# Adding version as cache key
key: ${{ runner.os }}-qt-${{ env.QT_VERSION }}-em-${{ env.EMSCRIPTEN }}-libegl1
- name: Install dependencies
if: steps.cached_qt_emscripten.outputs.cache-hit != 'true'
run: |
sudo apt-get update -yq &&
sudo apt-get install -y g++ build-essential mesa-common-dev libssl-dev \
wget lsb libgl1-mesa-dev libxkbcommon-x11-0 libpulse-dev p7zip-full \
ninja-build dos2unix libegl1
sudo snap install yq
- name: Install libraries needed for building the wasm
run: |
sudo apt-get update -yq &&
sudo apt-get install -y libegl1
- name: Set up Python 3.x
if: steps.cached_qt_emscripten.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install Qt ${{env.QT_VERSION}} linux desktop
if: steps.cached_qt_emscripten.outputs.cache-hit != 'true'
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: "${{env.QT_VERSION}}"
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
modules: 'qtwebsockets qt5compat qtshadertools'
dir: '/opt/hostedtoolcache'

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DRUN_UNIT_TESTS=${{env.RUN_UNIT_TESTS}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

0 comments on commit eb17eaa

Please sign in to comment.