Added cmake install #199
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push | |
env: | |
build_dir: ${{ github.workspace }}/build | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- macos-11 | |
- macos-12 | |
- macos-13 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Select Xcode 15.0 (for macOS 13) | |
run: sudo xcode-select -s "/Applications/Xcode_15.0.app" | |
if: matrix.os == 'macos-13' | |
- name: Configure CMake | |
run: cmake -B ${{ env.build_dir }} | |
- name: Build tests | |
run: cmake --build ${{ env.build_dir }} | |
- name: Run tests | |
run: ctest --build-config | |
working-directory: ${{ env.build_dir }} | |
- name: Run install | |
run: sudo cmake --install ${{ env.build_dir }} | |
- name: Prepare install test directory | |
run: mkdir -p cmake-test | |
- name: Run install test | |
run: | | |
cat <<EOS > main.cpp | |
#include <tmp/file> | |
#include <iostream> | |
int main() | |
{ | |
auto tmpfile = tmp::file("tmp.test"); | |
std::cout << tmpfile.release(); | |
return 0; | |
} | |
EOS | |
cat <<EOS > CMakeLists.txt | |
cmake_minimum_required(VERSION 3.12) | |
project(cmake-test LANGUAGES CXX) | |
find_package(tmp REQUIRED) | |
add_executable(cmake-test main.cpp) | |
target_link_libraries(cmake-test tmp::tmp) | |
EOS | |
cat main.cpp | |
cat CMakeLists.txt | |
cmake -B . | |
cmake --build . | |
test -f $(./cmake-test) | |
working-directory: ${{ github.workspace }}/cmake-test |