Skip to content

Commit

Permalink
Tidy up CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Apr 30, 2024
1 parent da5e2fd commit 2f2d9d5
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:

env:
build_dir: ${{ github.workspace }}/build
install_test_dir: ${{ github.workspace }}/install-test

jobs:
test:
Expand Down Expand Up @@ -37,32 +38,29 @@ jobs:
run: ctest --build-config
working-directory: ${{ env.build_dir }}

- name: Run install
- name: Run installation
run: sudo cmake --install ${{ env.build_dir }}

- name: Prepare install test directory
run: mkdir -p cmake-test
- name: Run install test
- name: Prepare installation test directory
run: mkdir -p ${{ env.install_test_dir }}

- name: Test installation
run: |
cat <<EOS > main.cpp
#include <tmp/file>
#include <iostream>
int main()
{
auto tmpfile = tmp::file("tmp.test");
std::cout << tmpfile.release().native();
return 0;
#include <tmp/file>
int main() {
std::cout << tmp::file().release().native();
}
EOS
cat <<EOS > CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(cmake-test LANGUAGES CXX)
project(install-test LANGUAGES CXX)
find_package(tmp REQUIRED)
add_executable(cmake-test main.cpp)
target_link_libraries(cmake-test tmp::tmp)
add_executable(install-test main.cpp)
target_link_libraries(install-test tmp::tmp)
EOS
cmake -B .
cmake --build .
test -f $(./cmake-test)
working-directory: ${{ github.workspace }}/cmake-test
working-directory: ${{ env.install_test_dir }}

0 comments on commit 2f2d9d5

Please sign in to comment.