mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-04 05:43:42 +00:00 
			
		
		
		
	ci: audit test action jobs in Test workflow (#275)
* ci: checkout action to `cmake-action` directory * ci: simplify steps in `test-action-with-specified-dirs` job * ci: test action without build by modifying project instead * ci: modify `test-action-with-custom-tools` job to `test-action-with-custom-generator * ci: remove `test-action-with-additional-args` job
This commit is contained in:
		
							parent
							
								
									d83693c521
								
							
						
					
					
						commit
						6f06d655fe
					
				
							
								
								
									
										99
									
								
								.github/workflows/test.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										99
									
								
								.github/workflows/test.yaml
									
									
									
									
										vendored
									
									
								
							@ -61,6 +61,7 @@ jobs:
 | 
				
			|||||||
      - name: Checkout
 | 
					      - name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v4.1.2
 | 
					        uses: actions/checkout@v4.1.2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
 | 
					          path: cmake-action
 | 
				
			||||||
          sparse-checkout: |
 | 
					          sparse-checkout: |
 | 
				
			||||||
            action.yml
 | 
					            action.yml
 | 
				
			||||||
            dist
 | 
					            dist
 | 
				
			||||||
@ -68,10 +69,10 @@ jobs:
 | 
				
			|||||||
          sparse-checkout-cone-mode: false
 | 
					          sparse-checkout-cone-mode: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Move Project
 | 
					      - name: Move Project
 | 
				
			||||||
        run: mv test/* .
 | 
					        run: mv cmake-action/test/* .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Configure and Build Project
 | 
					      - name: Configure and Build Project
 | 
				
			||||||
        uses: ./
 | 
					        uses: ./cmake-action
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Test Project
 | 
					      - name: Test Project
 | 
				
			||||||
        uses: threeal/ctest-action@v1.0.0
 | 
					        uses: threeal/ctest-action@v1.0.0
 | 
				
			||||||
@ -86,6 +87,7 @@ jobs:
 | 
				
			|||||||
      - name: Checkout
 | 
					      - name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v4.1.2
 | 
					        uses: actions/checkout@v4.1.2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
 | 
					          path: cmake-action
 | 
				
			||||||
          sparse-checkout: |
 | 
					          sparse-checkout: |
 | 
				
			||||||
            action.yml
 | 
					            action.yml
 | 
				
			||||||
            dist
 | 
					            dist
 | 
				
			||||||
@ -94,19 +96,15 @@ jobs:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      - name: Configure and Build Project
 | 
					      - name: Configure and Build Project
 | 
				
			||||||
        id: cmake-action
 | 
					        id: cmake-action
 | 
				
			||||||
        uses: ./
 | 
					        uses: ./cmake-action
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: cmake-action/test
 | 
				
			||||||
          build-dir: output
 | 
					          build-dir: output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Default Build Directory Should Not Exist
 | 
					 | 
				
			||||||
        shell: bash
 | 
					 | 
				
			||||||
        run: test ! -e build && test ! -e test/build
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Test Project
 | 
					      - name: Test Project
 | 
				
			||||||
        uses: threeal/ctest-action@v1.0.0
 | 
					        uses: threeal/ctest-action@v1.0.0
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          test-dir: ${{ steps.cmake-action.outputs.build-dir }}
 | 
					          test-dir: output
 | 
				
			||||||
          tests-regex: hello_world
 | 
					          tests-regex: hello_world
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test-action-without-run-build:
 | 
					  test-action-without-run-build:
 | 
				
			||||||
@ -116,76 +114,31 @@ jobs:
 | 
				
			|||||||
      - name: Checkout
 | 
					      - name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v4.1.2
 | 
					        uses: actions/checkout@v4.1.2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
 | 
					          path: cmake-action
 | 
				
			||||||
          sparse-checkout: |
 | 
					          sparse-checkout: |
 | 
				
			||||||
            action.yml
 | 
					            action.yml
 | 
				
			||||||
            dist
 | 
					            dist
 | 
				
			||||||
            test
 | 
					            test
 | 
				
			||||||
          sparse-checkout-cone-mode: false
 | 
					          sparse-checkout-cone-mode: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - name: Modify Project
 | 
				
			||||||
 | 
					        run: echo 'invalid' >> cmake-action/test/hello_world.cpp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Configure Project
 | 
					      - name: Configure Project
 | 
				
			||||||
        id: cmake-action
 | 
					        id: cmake-action
 | 
				
			||||||
        uses: ./
 | 
					        uses: ./cmake-action
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: cmake-action/test
 | 
				
			||||||
          run-build: false
 | 
					          run-build: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Try to Test Project
 | 
					  test-action-with-custom-generator:
 | 
				
			||||||
        id: failed-step
 | 
					    name: Test Action With Custom Generator
 | 
				
			||||||
        continue-on-error: true
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
        uses: threeal/ctest-action@v1.0.0
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          test-dir: ${{ steps.cmake-action.outputs.build-dir }}
 | 
					 | 
				
			||||||
          tests-regex: hello_world
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Previous Step Should Failed
 | 
					 | 
				
			||||||
        if: steps.failed-step.outcome == 'success'
 | 
					 | 
				
			||||||
        run: exit 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  test-action-with-additional-args:
 | 
					 | 
				
			||||||
    name: Test Action With Additional Arguments
 | 
					 | 
				
			||||||
    runs-on: ${{ matrix.compiler == 'msvc' && 'windows' || 'ubuntu' }}-latest
 | 
					 | 
				
			||||||
    strategy:
 | 
					 | 
				
			||||||
      fail-fast: false
 | 
					 | 
				
			||||||
      matrix:
 | 
					 | 
				
			||||||
        compiler: [gcc, msvc]
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      - name: Checkout
 | 
					 | 
				
			||||||
        uses: actions/checkout@v4.1.2
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          sparse-checkout: |
 | 
					 | 
				
			||||||
            action.yml
 | 
					 | 
				
			||||||
            dist
 | 
					 | 
				
			||||||
            test
 | 
					 | 
				
			||||||
          sparse-checkout-cone-mode: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Configure and Build Project
 | 
					 | 
				
			||||||
        id: cmake-action
 | 
					 | 
				
			||||||
        uses: ./
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          source-dir: test
 | 
					 | 
				
			||||||
          c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
					 | 
				
			||||||
          cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
					 | 
				
			||||||
          options: CHECK_SURPASS_WARNING=ON
 | 
					 | 
				
			||||||
          build-args: --target test_c --target test_cpp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      - name: Test Project
 | 
					 | 
				
			||||||
        uses: threeal/ctest-action@v1.0.0
 | 
					 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          test-dir: ${{ steps.cmake-action.outputs.build-dir }}
 | 
					 | 
				
			||||||
          build-config: Debug
 | 
					 | 
				
			||||||
          tests-regex: test
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  test-action-with-custom-tools:
 | 
					 | 
				
			||||||
    name: Test Action With Custom Tools
 | 
					 | 
				
			||||||
    runs-on: ${{ matrix.os }}-latest
 | 
					 | 
				
			||||||
    strategy:
 | 
					 | 
				
			||||||
      fail-fast: false
 | 
					 | 
				
			||||||
      matrix:
 | 
					 | 
				
			||||||
        os: [windows, ubuntu, macos]
 | 
					 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: Checkout
 | 
					      - name: Checkout
 | 
				
			||||||
        uses: actions/checkout@v4.1.2
 | 
					        uses: actions/checkout@v4.1.2
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
 | 
					          path: cmake-action
 | 
				
			||||||
          sparse-checkout: |
 | 
					          sparse-checkout: |
 | 
				
			||||||
            action.yml
 | 
					            action.yml
 | 
				
			||||||
            dist
 | 
					            dist
 | 
				
			||||||
@ -195,19 +148,13 @@ jobs:
 | 
				
			|||||||
      - name: Setup Ninja
 | 
					      - name: Setup Ninja
 | 
				
			||||||
        uses: seanmiddleditch/gha-setup-ninja@v4
 | 
					        uses: seanmiddleditch/gha-setup-ninja@v4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Configure and Build Project
 | 
					      - name: Configure Project
 | 
				
			||||||
        id: cmake-action
 | 
					        id: cmake-action
 | 
				
			||||||
        uses: ./
 | 
					        uses: ./cmake-action
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: cmake-action/test
 | 
				
			||||||
          generator: Ninja
 | 
					          generator: Ninja
 | 
				
			||||||
          c-compiler: clang
 | 
					          run-build: false
 | 
				
			||||||
          cxx-compiler: clang++
 | 
					 | 
				
			||||||
          options: CHECK_USING_CLANG=ON
 | 
					 | 
				
			||||||
          build-args: --target test_c --target test_cpp
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Test Project
 | 
					      - name: Build Project
 | 
				
			||||||
        uses: threeal/ctest-action@v1.0.0
 | 
					        run: ninja -C ${{ steps.cmake-action.outputs.build-dir }}
 | 
				
			||||||
        with:
 | 
					 | 
				
			||||||
          test-dir: ${{ steps.cmake-action.outputs.build-dir }}
 | 
					 | 
				
			||||||
          tests-regex: test
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user