mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-22 03:21:21 +00:00
108 lines
2.9 KiB
YAML
108 lines
2.9 KiB
YAML
name: test
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
jobs:
|
|
use-action:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
steps:
|
|
- name: Checkout 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 build result
|
|
run: ${{ matrix.os == 'windows-latest' && 'build\Debug\hello_world.exe' || 'build/hello_world' }}
|
|
|
|
use-action-with-specified-dir:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3.3.0
|
|
|
|
- name: Use this action with specified directory
|
|
uses: ./
|
|
with:
|
|
source-dir: test
|
|
build-dir: test/build
|
|
|
|
- name: Run build result
|
|
run: test/build/hello_world
|
|
|
|
- name: Check if the default build directory does not exist
|
|
run: test ! -d build
|
|
|
|
use-action-with-specified-targets:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3.3.0
|
|
|
|
- name: Use this action with specified targets
|
|
uses: ./
|
|
with:
|
|
source-dir: test
|
|
targets: test
|
|
|
|
- name: Run build result
|
|
run: build/test
|
|
|
|
use-action-with-specified-compiler:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
lang: [C, CXX]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3.3.0
|
|
|
|
- name: Use this action with specified invalid compiler
|
|
id: failed_step
|
|
continue-on-error: true
|
|
uses: ./
|
|
with:
|
|
source-dir: test
|
|
c-compiler: ${{ matrix.lang == 'C' && 'invalid' || '' }}
|
|
cxx-compiler: ${{ matrix.lang == 'CXX' && 'invalid' || '' }}
|
|
|
|
- name: Check if previous step is failing
|
|
run: ${{ steps.failed_step.outcome == 'failure' && 'true' || 'false' }}
|
|
|
|
- name: Use this action with specified compiler
|
|
uses: ./
|
|
with:
|
|
source-dir: test
|
|
c-compiler: ${{ matrix.lang == 'C' && 'clang' || '' }}
|
|
cxx-compiler: ${{ matrix.lang == 'CXX' && 'clang++' || '' }}
|
|
args: |
|
|
-D BUILD_C=${{ matrix.lang == 'C' && 'ON' || 'OFF' }}
|
|
-D BUILD_CXX=${{ matrix.lang == 'CXX' && 'ON' || 'OFF' }}
|
|
|
|
- name: Run build result
|
|
run: build/${{ matrix.lang == 'C' && 'hello_world_c' || 'hello_world' }}
|
|
|
|
use-action-with-specified-generator:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3.3.0
|
|
|
|
- name: Use this action with specified generator
|
|
uses: ./
|
|
with:
|
|
source-dir: test
|
|
generator: Ninja
|
|
|
|
- name: Run build result
|
|
run: build/hello_world
|