mirror of
				https://github.com/threeal/cmake-action.git
				synced 2025-11-03 21:33:42 +00:00 
			
		
		
		
	add support to run test_c and test_cpp targets as a CMake test
				
					
				
			This commit is contained in:
		
							parent
							
								
									03870ba3b0
								
							
						
					
					
						commit
						c04ca4c05a
					
				
							
								
								
									
										14
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							@ -32,7 +32,7 @@ jobs:
 | 
				
			|||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
          build-dir: output
 | 
					          build-dir: output
 | 
				
			||||||
          run_test: true
 | 
					          run-test: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - name: Check if the default build directory does not exist
 | 
					      - name: Check if the default build directory does not exist
 | 
				
			||||||
        run: test ! -d build && test ! -d test/build
 | 
					        run: test ! -d build && test ! -d test/build
 | 
				
			||||||
@ -51,14 +51,11 @@ jobs:
 | 
				
			|||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
          targets: test_c test_cpp
 | 
					          targets: test_c test_cpp
 | 
				
			||||||
 | 
					          run-test: true
 | 
				
			||||||
          c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
					          c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
				
			||||||
          cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
					          cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
 | 
				
			||||||
          args: -D CHECK_SURPASS_WARNING=ON
 | 
					          args: -D CHECK_SURPASS_WARNING=ON
 | 
				
			||||||
 | 
					          test-args: -C test
 | 
				
			||||||
      - name: Run the build results
 | 
					 | 
				
			||||||
        run: |
 | 
					 | 
				
			||||||
          ${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_c.exe' || 'test/build/test_c' }}
 | 
					 | 
				
			||||||
          ${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_cpp.exe' || 'test/build/test_cpp' }}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  specified-compiler-usage:
 | 
					  specified-compiler-usage:
 | 
				
			||||||
    runs-on: ${{ matrix.os }}-latest
 | 
					    runs-on: ${{ matrix.os }}-latest
 | 
				
			||||||
@ -74,13 +71,12 @@ jobs:
 | 
				
			|||||||
        with:
 | 
					        with:
 | 
				
			||||||
          source-dir: test
 | 
					          source-dir: test
 | 
				
			||||||
          targets: test_c test_cpp
 | 
					          targets: test_c test_cpp
 | 
				
			||||||
 | 
					          run-test: true
 | 
				
			||||||
          generator: Ninja
 | 
					          generator: Ninja
 | 
				
			||||||
          c-compiler: clang
 | 
					          c-compiler: clang
 | 
				
			||||||
          cxx-compiler: clang++
 | 
					          cxx-compiler: clang++
 | 
				
			||||||
          args: -D CHECK_USING_CLANG=ON
 | 
					          args: -D CHECK_USING_CLANG=ON
 | 
				
			||||||
 | 
					          test-args: -C test
 | 
				
			||||||
      - name: Run the build results
 | 
					 | 
				
			||||||
        run: test/build/test_c && test/build/test_cpp
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  specified-generator-usage:
 | 
					  specified-generator-usage:
 | 
				
			||||||
    runs-on: ${{ matrix.os }}-latest
 | 
					    runs-on: ${{ matrix.os }}-latest
 | 
				
			||||||
 | 
				
			|||||||
@ -28,4 +28,5 @@ foreach(LANG ${LANGS})
 | 
				
			|||||||
    $<$<BOOL:${CHECK_USING_CLANG}>:CHECK_USING_CLANG>
 | 
					    $<$<BOOL:${CHECK_USING_CLANG}>:CHECK_USING_CLANG>
 | 
				
			||||||
    $<$<BOOL:${CHECK_SURPASS_WARNING}>:CHECK_SURPASS_WARNING>
 | 
					    $<$<BOOL:${CHECK_SURPASS_WARNING}>:CHECK_SURPASS_WARNING>
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					  add_test(NAME test_${LANG} CONFIGURATIONS test COMMAND $<TARGET_FILE:test_${LANG}>)
 | 
				
			||||||
endforeach()
 | 
					endforeach()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user