@@ -3,69 +3,56 @@ name: Build and Test
33on : [push, workflow_dispatch]
44
55env :
6- # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
76 BUILD_TYPE : Release
87
98jobs :
109 build :
11- # The CMake configure and build commands are platform agnostic and should work equally
12- # well on Windows or Mac. You can convert this to a matrix build if you need
13- # cross-platform coverage.
14- # See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
1510 runs-on : ${{ matrix.os }}
1611 strategy :
1712 fail-fast : false
1813 matrix :
19- os : [macos-10.15 , macos-11 , ubuntu-20.04]
14+ os : [macos-11 , macos-12 , ubuntu-20.04, ubuntu-22 .04]
2015
2116 steps :
2217 - uses : actions/checkout@v2
2318
2419 - name : Setup Ubuntu
25- if : matrix.os == 'ubuntu-20.04'
20+ if : startsWith( matrix.os, 'ubuntu')
2621 run : |
2722 sudo apt-get update
2823 sudo apt-get install -y cmake
2924
30- - name : Setup macOS 10.15
31- if : matrix.os == 'macos-10.15'
25+ - name : Setup macOS
26+ if : startsWith( matrix.os, 'macos')
3227 run : |
3328 sudo xcode-select -s /Library/Developer/CommandLineTools/
34- sudo rm /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
35- sudo rm -rf /Library/Developer/CommandLineTools/SDKs/MacOSX11*.sdk
36- sudo ln -sf MacOSX10.15.sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
29+ sudo rm -rf /Library/Frameworks/Mono.framework
3730 brew install cmake
3831
39- - name : Setup macOS 11
40- if : matrix.os == 'macos-11'
41- run : |
42- sudo xcode-select -s /Library/Developer/CommandLineTools/
43- brew install cmake
44-
45- - name : Create Build Environment
46- # Some projects don't allow in-source building, so create a separate build directory
47- # We'll use this as our working directory for all subsequent commands
48- run : cmake -E make_directory ${{runner.workspace}}/build
49-
5032 - name : Configure CMake
51- # Use a bash shell so we can use the same syntax for environment variable
52- # access regardless of the host operating system
5333 shell : bash
54- working-directory : ${{runner.workspace}}/build
55- # Note the current convention is to use the -S and -B options here to specify source
56- # and build directories, but this is only available with CMake 3.13 and higher.
57- # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
58- run : cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
34+ run : |
35+ cmake -S $GITHUB_WORKSPACE -B ${{runner.workspace}}/build \
36+ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
37+ -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install
5938
6039 - name : Build
61- working-directory : ${{runner.workspace}}/build
6240 shell : bash
6341 # Execute the build. You can specify a specific target with "--target <NAME>"
64- run : cmake --build . --config $BUILD_TYPE
42+ run : cmake --build ${{runner.workspace}}/build --config $BUILD_TYPE
6543
66- - name : Test
44+ - name : Test libjpeg
6745 working-directory : ${{runner.workspace}}/build
6846 shell : bash
69- # Execute tests defined by the CMake configuration.
70- # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
7147 run : ctest -V -C $BUILD_TYPE
48+
49+ - name : Test install
50+ shell : bash
51+ run : |
52+ cmake --install ${{runner.workspace}}/build --config $BUILD_TYPE
53+ RESULT=$(cmake --find-package -DNAME=JPEG \
54+ -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE \
55+ -DCMAKE_PREFIX_PATH=${{runner.workspace}}/install | awk '{$1=$1};1')
56+ [[ "$RESULT" != "-I${{runner.workspace}}/install/include" ]] && { echo "libjpeg not found or found at unexpected location: ${RESULT}" ; exit 1; }
57+ exit 0
58+
0 commit comments