-
Notifications
You must be signed in to change notification settings - Fork 9
151 lines (128 loc) · 4.93 KB
/
c-cpp.yml
File metadata and controls
151 lines (128 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: C/C++ CI
on:
push:
pull_request:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
#ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
# - os: macos-latest
# triplet: x64-osx
continue-on-error: true
env:
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
- name: Set OS environment variable in lowercase letters
run: echo "CURRENT_OS=$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
shell: bash
- name: Set up cache
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: actions/checkout@v4
- name: Create vcpkg default binary cache
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
mkdir -p ${{ github.workspace }}\vcpkg\bincache
else
mkdir -p ${{ github.workspace }}/vcpkg/bincache
fi
shell: bash
- name: Install packages
if: runner.os == 'Linux'
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
- if: runner.os == 'macOS'
run: brew install nasm
- uses: lukka/get-cmake@v3.26.0
- name: Set up vcpkg
uses: lukka/run-vcpkg@v11
with:
setupOnly: true
vcpkgGitCommitId: d320630b28aeb59b24424eb2a7ef3905314107a1
# Restore vpkg cache
- name: Restore vcpkg
uses: actions/cache@v4
with:
path: |
${{ env._VCPKG_ }}
!${{ env._VCPKG_ }}/buildtrees
!${{ env._VCPKG_ }}/packages
!${{ env._VCPKG_ }}/downloads
!${{ env._VCPKG_ }}/installed
key: |
${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
# Ensure that the developer command promt is present on Windows runners
- uses: ilammy/msvc-dev-cmd@v1
- name: Run CMake consuming CMakePreset.json and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
configurePreset: ${{ env.CURRENT_OS }}-release
configurePresetAdditionalArgs: "['-DBUILD_EXAMPLE_APP=ON','-DBUILD_TESTS=ON']"
buildPreset: ${{ env.CURRENT_OS }}-release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ env.CURRENT_OS }}
path: |
bin/build/${{ env.CURRENT_OS }}-release/example
bin/build/${{ env.CURRENT_OS }}-release/test/Iris.Tests
bin/build/${{ env.CURRENT_OS }}-release/test/AddressSanitizer.Tests
bin/build/${{ env.CURRENT_OS }}-release/CTestTestfile.cmake
- name: Upload vcpkg logs on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: vckpg-fail-logs
path: |
D:\a\fonttik\fonttik\bin\build\windows-release\vcpkg_installed\vcpkg\blds\opencv4\*.log
retention-days: 1
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
#ubuntu-latest, macos-latest, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
# - os: macos-latest
# triplet: x64-osx
continue-on-error: true
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- name: Set environment variable in lowercase letters
run: echo "CURRENT_OS=$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
shell: bash
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ env.CURRENT_OS }}
path: bin/build/${{ env.CURRENT_OS }}-release
- name: Set permissions
if: runner.os == 'linux' || runner.os == 'macOS'
run: |
if [ "$RUNNER_OS" == "linux" ]; then
sudo apt-get update && sudo apt-get install -y libegl1-mesa && sudo chmod +x bin/build/linux-release/test/Iris.Tests/iris_tests
elif [ "$RUNNER_OS" == "macOS" ]; then
chmod 755 bin/build/macos-release/test/Iris.Tests/iris_tests
fi
shell: bash
- name: Test
run: |
ctest --preset test-${{ env.CURRENT_OS }}