From 565c104d584f6d6697d8d1a51a63cc775c95a8b1 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 25 Mar 2024 14:19:39 +0700 Subject: [PATCH] ci: use `threeal/cmake-starter` for testing the action --- .github/workflows/test.yaml | 49 +++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8bd81f0..e44dc9e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -58,91 +58,103 @@ jobs: matrix: os: [windows, ubuntu, macos] steps: - - name: Checkout + - name: Checkout Project + uses: actions/checkout@v4.1.2 + with: + repository: threeal/cpp-starter + + - name: Checkout Action uses: actions/checkout@v4.1.2 with: path: cmake-action sparse-checkout: | action.yml dist - test sparse-checkout-cone-mode: false - - name: Move Project - run: mv cmake-action/test/* . - - name: Configure and Build Project uses: ./cmake-action + with: + options: BUILD_TESTING=ON - name: Test Project uses: threeal/ctest-action@v1.0.0 with: build-config: Debug - tests-regex: hello_world test-action-with-specified-dirs: name: Test Action With Specified Directories runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout Project + uses: actions/checkout@v4.1.2 + with: + repository: threeal/cpp-starter + path: project + + - name: Checkout Action uses: actions/checkout@v4.1.2 with: path: cmake-action sparse-checkout: | action.yml dist - test sparse-checkout-cone-mode: false - name: Configure and Build Project - id: cmake-action uses: ./cmake-action with: - source-dir: cmake-action/test + source-dir: project build-dir: output + options: BUILD_TESTING=ON - name: Test Project uses: threeal/ctest-action@v1.0.0 with: test-dir: output - tests-regex: hello_world test-action-without-run-build: name: Test Action Without Run Build runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout Project + uses: actions/checkout@v4.1.2 + with: + repository: threeal/cpp-starter + + - name: Checkout Action uses: actions/checkout@v4.1.2 with: path: cmake-action sparse-checkout: | action.yml dist - test sparse-checkout-cone-mode: false - name: Modify Project - run: echo 'invalid' >> cmake-action/test/hello_world.cpp + run: echo 'invalid' >> src/main.cpp - name: Configure Project - id: cmake-action uses: ./cmake-action with: - source-dir: cmake-action/test run-build: false test-action-with-custom-generator: name: Test Action With Custom Generator runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout Project + uses: actions/checkout@v4.1.2 + with: + repository: threeal/cpp-starter + + - name: Checkout Action uses: actions/checkout@v4.1.2 with: path: cmake-action sparse-checkout: | action.yml dist - test sparse-checkout-cone-mode: false - name: Setup Ninja @@ -152,7 +164,6 @@ jobs: id: cmake-action uses: ./cmake-action with: - source-dir: cmake-action/test generator: Ninja run-build: false