Skip to content

Tidy up CI test

Tidy up CI test #204

Workflow file for this run

name: Tests
on:
- push
- pull_request
env:
build_dir: ${{ github.workspace }}/build
install_test_dir: ${{ github.workspace }}/install-test
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 installation
run: sudo cmake --install ${{ env.build_dir }}
- name: Prepare installation test directory
run: mkdir -p ${{ env.install_test_dir }}
- name: Test installation
run: |
cat <<EOS > main.cpp
#include <iostream>
#include <tmp/file>
int main() {
std::cout << tmp::file().release().native();
}
EOS
cat <<EOS > CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(install-test LANGUAGES CXX)
find_package(tmp REQUIRED)
add_executable(install-test main.cpp)
target_link_libraries(install-test tmp::tmp)
EOS
cmake -B .
cmake --build .
test -f $(./cmake-test)
working-directory: ${{ env.install_test_dir }}