@@ -2,26 +2,152 @@ name: C/C++ CI
22
33on :
44 push :
5- branches : " **"
65 pull_request :
7- branches : [ "main", "dev" ]
8- workflow_dispatch :
6+ branches :
7+ - main
8+
99jobs :
1010 build :
11+ runs-on : ${{ matrix.os }}
12+ strategy :
13+ matrix :
14+ os : [ubuntu-latest, windows-latest]
15+ # ubuntu-latest, macos-latest, windows-latest]
16+ include :
17+ - os : windows-latest
18+ triplet : x64-windows
19+ - os : ubuntu-latest
20+ triplet : x64-linux
21+ # - os: macos-latest
22+ # triplet: x64-osx
23+
24+ continue-on-error : true
25+
26+ env :
27+ VCPKG_BINARY_SOURCES : ' clear;x-gha,readwrite'
28+
29+ steps :
30+ - name : Set OS environment variable in lowercase letters
31+ run : echo "CURRENT_OS=$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
32+ shell : bash
33+
34+ - name : Set up cache
35+ uses : actions/github-script@v7
36+ with :
37+ script : |
38+ core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
39+ core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
1140
12- runs-on : ubuntu-latest
41+ - uses : actions/checkout@v4
1342
14- steps :
15- - uses : actions/checkout@v3
16- - name : update apt
17- run : |
18- sudo apt-get update -y \
19- apt-get install --yes ninja-build rsync zip \
20- apt-get install --yes pkg-config \
21- git clone https://github.com/Microsoft/vcpkg.git \
22- export VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT \
43+ - name : Create vcpkg default binary cache
44+ run : |
45+ if [ "$RUNNER_OS" == "Windows" ]; then
46+ mkdir -p ${{ github.workspace }}\vcpkg\bincache
47+ else
48+ mkdir -p ${{ github.workspace }}/vcpkg/bincache
49+ fi
50+ shell : bash
51+
52+ - name : Install packages
53+ if : runner.os == 'Linux'
54+ run : sudo apt-get install -y libxi-dev libxtst-dev bison gperf libgles2-mesa-dev libxrandr-dev libxcursor-dev libxdamage-dev libxinerama-dev nasm autoconf automake libtool pkg-config libltdl-dev
55+
56+ - if : runner.os == 'macOS'
57+ run : brew install nasm
58+
59+ - uses : lukka/get-cmake@v3.26.0
60+
61+ - name : Set up vcpkg
62+ uses : lukka/run-vcpkg@v4
63+ with :
64+ setupOnly : true
65+ vcpkgGitCommitId : d320630b28aeb59b24424eb2a7ef3905314107a1
66+
67+ # Restore vpkg cache
68+ - name : Restore vcpkg
69+ uses : actions/cache@v4
70+ with :
71+ path : |
72+ ${{ env._VCPKG_ }}
73+ !${{ env._VCPKG_ }}/buildtrees
74+ !${{ env._VCPKG_ }}/packages
75+ !${{ env._VCPKG_ }}/downloads
76+ !${{ env._VCPKG_ }}/installed
77+ key : |
78+ ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
2379
24- - name : cmake configure
25- run : cmake --preset linux-release
26- - name : build
27- run : cmake --build --preset linux-release
80+ # Ensure that the developer command promt is present on Windows runners
81+ - uses : ilammy/msvc-dev-cmd@v1
82+
83+ - name : Restore from cache the dependencies and generate project files
84+ run : |
85+ cmake -DBUILD_EXAMPLE_APP=ON -DBUILD_TESTS=ON --preset ${{ env.CURRENT_OS }}-release
86+
87+ - name : Build (Release configuration)
88+ run : |
89+ cmake --build --preset ${{ env.CURRENT_OS }}-release
90+
91+ - name : Upload build artifacts
92+ uses : actions/upload-artifact@v4
93+ with :
94+ name : build-artifacts-${{ env.CURRENT_OS }}
95+ path : |
96+ bin/build/${{ env.CURRENT_OS }}-release/example
97+ bin/build/${{ env.CURRENT_OS }}-release/test/Iris.Tests
98+ bin/build/${{ env.CURRENT_OS }}-release/test/AddressSanitizer.Tests
99+ bin/build/${{ env.CURRENT_OS }}-release/CTestTestfile.cmake
100+ - name : Upload vcpkg logs on fail
101+ if : ${{ failure() }}
102+ uses : actions/upload-artifact@v4
103+ with :
104+ name : vckpg-fail-logs
105+ path : |
106+ D:\a\fonttik\fonttik\bin\build\windows-release\vcpkg_installed\vcpkg\blds\opencv4\*.log
107+ retention-days : 1
108+ test :
109+ needs : build
110+ runs-on : ${{ matrix.os }}
111+ strategy :
112+ matrix :
113+ os : [ubuntu-latest, windows-latest]
114+ # ubuntu-latest, macos-latest, windows-latest]
115+ include :
116+ - os : windows-latest
117+ triplet : x64-windows
118+ - os : ubuntu-latest
119+ triplet : x64-linux
120+ # - os: macos-latest
121+ # triplet: x64-osx
122+
123+ continue-on-error : true
124+
125+ if : github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
126+
127+ steps :
128+ - name : Set environment variable in lowercase letters
129+ run : echo "CURRENT_OS=$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
130+ shell : bash
131+
132+ - uses : actions/checkout@v4
133+
134+ - name : Download build artifacts
135+ uses : actions/download-artifact@v4
136+ with :
137+ name : build-artifacts-${{ env.CURRENT_OS }}
138+ path : bin/build/${{ env.CURRENT_OS }}-release
139+
140+ - name : Set permissions
141+ if : runner.os == 'linux' || runner.os == 'macOS'
142+ run : |
143+ if [ "$RUNNER_OS" == "linux" ]; then
144+ sudo apt-get update && sudo apt-get install -y libegl1-mesa && sudo chmod +x bin/build/linux-release/test/Iris.Tests/iris_tests
145+ elif [ "$RUNNER_OS" == "macOS" ]; then
146+ chmod 755 bin/build/macos-release/test/Iris.Tests/iris_tests
147+ fi
148+ shell : bash
149+
150+ - name : Test
151+ run : |
152+ ctest --preset test-${{ env.CURRENT_OS }}
153+
0 commit comments