Skip to content

Commit e462d2c

Browse files
committed
chore: enable unit testing in nightlies
1 parent 1863b03 commit e462d2c

5 files changed

Lines changed: 48 additions & 6 deletions

File tree

.github/actions/test/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Run Tests
2+
description: Run test suite
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Run tests
8+
shell: bash
9+
run: ctest --test-dir build -C Release --output-on-failure

.github/workflows/build-linux.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Build Linux
22

33
on:
44
workflow_call:
5+
inputs:
6+
run_tests:
7+
description: Build and run tests
8+
required: false
9+
type: boolean
10+
default: false
511

612
jobs:
713
build-linux:
@@ -27,14 +33,21 @@ jobs:
2733
build-essential cmake git wget
2834
2935
- name: Clone repositories
30-
run: cmake -P Setup.cmake
36+
run: cmake -DREDASM_FETCH_TESTS=${{ inputs.run_tests && 'ON' || 'OFF' }} -P Setup.cmake
3137

3238
- name: Configure
33-
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
39+
run: cmake -B build \
40+
-DCMAKE_BUILD_TYPE=Release \
41+
-DCMAKE_INSTALL_PREFIX=/usr \
42+
${{ inputs.run_tests && format('-DREDASM_FETCH_TESTS=ON -DREDASM_SAMPLES={0}/samples', github.workspace) || '' }}
3443

3544
- name: Build
3645
run: cmake --build build --parallel
3746

47+
- name: Run tests
48+
if: inputs.run_tests
49+
uses: ./.github/actions/test
50+
3851
- name: Install into AppDir
3952
run: cmake --install build --prefix AppDir/usr
4053

.github/workflows/build-windows.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Build Windows
22

33
on:
44
workflow_call:
5+
inputs:
6+
run_tests:
7+
description: Build and run test suite
8+
required: false
9+
type: boolean
10+
default: false
511

612
jobs:
713
build-windows:
@@ -21,14 +27,20 @@ jobs:
2127
cache: true
2228

2329
- name: Clone repositories
24-
run: cmake -P Setup.cmake
30+
run: cmake -DREDASM_FETCH_TESTS=${{ inputs.run_tests && 'ON' || 'OFF' }} -P Setup.cmake
2531

2632
- name: Configure
27-
run: cmake -B build -DCMAKE_PREFIX_PATH="${{ env.Qt6_DIR }}"
33+
run: cmake -B build `
34+
-DCMAKE_PREFIX_PATH="${{ env.Qt6_DIR }}" `
35+
${{ inputs.run_tests && format('-DREDASM_FETCH_TESTS=ON -DREDASM_SAMPLES={0}/samples', github.workspace) || '' }}
2836

2937
- name: Build
3038
run: cmake --build build --config Release --parallel
3139

40+
- name: Run tests
41+
if: inputs.run_tests
42+
uses: ./.github/actions/test
43+
3244
- name: Install
3345
run: cmake --install build --prefix redasm-windows-x86_64 --config Release
3446

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ concurrency:
1414
jobs:
1515
build-linux:
1616
uses: ./.github/workflows/build-linux.yml
17+
with:
18+
run_tests: true
1719

1820
build-windows:
1921
uses: ./.github/workflows/build-windows.yml
22+
with:
23+
run_tests: true

Setup.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ cmake_minimum_required(VERSION 3.25)
22

33
find_package(Git REQUIRED)
44

5-
option(REDASM_FETCH_TESTS "Fetch tests and samples repositories" OFF)
6-
75
if(NOT GIT_FOUND)
86
message(FATAL_ERROR "Git is required to clone repositories. Please install Git and try again.")
97
endif()
108

9+
if(NOT DEFINED REDASM_FETCH_TESTS)
10+
set(REDASM_FETCH_TESTS OFF)
11+
endif()
12+
1113
# Version overrides: set via -D or environment for CI/release builds
1214
# e.g: cmake -DCORE_VERSION=v4.0.1 -P setup.cmake
1315
set(CORE_VERSION $ENV{CORE_VERSION})
@@ -51,6 +53,8 @@ set(REPO_processors ${PROCESSORS_VERSION})
5153
set(REPO_commands ${COMMANDS_VERSION})
5254
set(REPO_analyzers ${ANALYZERS_VERSION})
5355
set(REPO_kb ${KB_VERSION})
56+
set(REPO_tests "master") # no tagging here
57+
set(REPO_samples "master") # no tagging here
5458

5559
set(REPOS
5660
core

0 commit comments

Comments
 (0)