cmake-action/.github/workflows/test.yaml
dependabot[bot] 4b65ad3339
chore: bump actions/checkout from 4.1.6 to 4.1.7 (#338)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.6 to 4.1.7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4.1.6...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alfi Maulana <alfi.maulana.f@gmail.com>
2024-06-22 15:43:20 +07:00

168 lines
4.0 KiB
YAML

name: Test
on:
workflow_dispatch:
pull_request:
push:
branches: [main]
jobs:
test-package:
name: Test Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: latest
- name: Setup Yarn
uses: threeal/setup-yarn-action@v2.0.0
with:
version: stable
- name: Test Package
run: yarn test
test-action:
name: Test Action
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [windows, ubuntu, macos]
steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
with:
repository: threeal/cpp-starter
- name: Checkout Action
uses: actions/checkout@v4.1.7
with:
path: cmake-action
sparse-checkout: |
action.yml
dist
sparse-checkout-cone-mode: false
- name: Configure and Build Project
id: cmake-action
uses: ./cmake-action
- name: Run Project
run: ${{ steps.cmake-action.outputs.build-dir }}/${{ matrix.os == 'windows' && 'Debug/generate_sequence.exe' || 'generate_sequence' }} 5
test-action-with-specified-dirs:
name: Test Action With Specified Directories
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
with:
repository: threeal/cpp-starter
path: project
- name: Checkout Action
uses: actions/checkout@v4.1.7
with:
path: cmake-action
sparse-checkout: |
action.yml
dist
sparse-checkout-cone-mode: false
- name: Configure and Build Project
id: cmake-action
uses: ./cmake-action
with:
source-dir: project
build-dir: output
- name: Run Project
run: output/generate_sequence 5
test-action-without-run-build:
name: Test Action Without Run Build
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
with:
repository: threeal/cpp-starter
- name: Checkout Action
uses: actions/checkout@v4.1.7
with:
path: cmake-action
sparse-checkout: |
action.yml
dist
sparse-checkout-cone-mode: false
- name: Modify Project
run: echo 'invalid' >> src/main.cpp
- name: Configure Project
uses: ./cmake-action
with:
run-build: false
test-action-with-additional-options:
name: Test Action With Additional Options
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
with:
repository: threeal/cpp-starter
- name: Checkout Action
uses: actions/checkout@v4.1.7
with:
path: cmake-action
sparse-checkout: |
action.yml
dist
sparse-checkout-cone-mode: false
- name: Configure and Build Project
uses: ./cmake-action
with:
options: BUILD_TESTING=ON
- name: Test Project
uses: threeal/ctest-action@v1.0.0
test-action-with-custom-generator:
name: Test Action With Custom Generator
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
with:
repository: threeal/cpp-starter
- name: Checkout Action
uses: actions/checkout@v4.1.7
with:
path: cmake-action
sparse-checkout: |
action.yml
dist
sparse-checkout-cone-mode: false
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
- name: Configure Project
id: cmake-action
uses: ./cmake-action
with:
generator: Ninja
run-build: false
- name: Build Project
run: ninja -C ${{ steps.cmake-action.outputs.build-dir }}