cmake-action/.github/workflows/test.yml

102 lines
2.6 KiB
YAML

name: test
on:
workflow_dispatch:
push:
jobs:
default-usage:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [windows, ubuntu, macos]
steps:
- name: Check out this repository
uses: actions/checkout@v3.3.0
- name: Move test project to the working directory
run: mv test/* .
- name: Use this action
uses: ./
- name: Run the build result
run: ${{ matrix.os == 'windows' && 'build\Debug\hello_world.exe' || 'build/hello_world' }}
specified-dir-usage:
runs-on: ubuntu-latest
steps:
- name: Check out this repository
uses: actions/checkout@v3.3.0
- name: Use this action with specified directories
uses: ./
with:
source-dir: test
build-dir: test/build
- name: Run the build result
run: test/build/hello_world
- name: Check if the default build directory does not exist
run: test ! -d build
additional-flags-usage:
runs-on: ${{ matrix.compiler == 'msvc' && 'windows' || 'ubuntu' }}-latest
strategy:
matrix:
compiler: [gcc, msvc]
steps:
- name: Check out this repository
uses: actions/checkout@v3.3.0
- name: Use this action with additional compiler flags
uses: ./
with:
source-dir: test
targets: test_c test_cpp
c-flags: ${{ matrix.compiler == 'msvc' && '/w' || '-Wno-unused-variable' }}
cxx-flags: ${{ matrix.compiler == 'msvc' && '/w' || '-Wno-unused-variable' }}
args: -D CHECK_SURPASS_WARNING=ON
- name: Run the build results
run: build/test_c && build/test_cpp
specified-compiler-usage:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [windows, ubuntu, macos]
steps:
- name: Check out this repository
uses: actions/checkout@v3.3.0
- name: Use this action with specified compilers
uses: ./
with:
source-dir: test
targets: test_c test_cpp
generator: Ninja
c-compiler: clang
cxx-compiler: clang++
args: -D CHECK_USING_CLANG=ON
- name: Run the build results
run: build/test_c && build/test_cpp
specified-generator-usage:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [windows, ubuntu, macos]
steps:
- name: Check out this repository
uses: actions/checkout@v3.3.0
- name: Use this action with a specified generator
uses: ./
with:
source-dir: test
generator: Ninja
- name: Run the build result
run: build/hello_world