-
Notifications
You must be signed in to change notification settings - Fork 981
142 lines (124 loc) · 5.27 KB
/
osx-tests.yml
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
name: OSX Tests
on:
push:
branches:
- develop2
- release/*
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
testing:
strategy:
fail-fast: true
matrix:
python-version: ['3.9']
test-type: [unittests, integration, functional]
runs-on: macos-14
name: Conan (${{ matrix.test-type }}) (${{ matrix.python-version }})
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
id: cache-pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('conans/requirements*.txt') }}
- name: Install Python requirements
run: |
pip install --upgrade pip
pip install -r conans/requirements.txt
pip install -r conans/requirements_server.txt
pip install -r conans/requirements_dev.txt
pip install meson
- name: Uninstall default CMake
run: brew uninstall cmake || true
- name: Cache Homebrew packages
id: cache-brew
uses: actions/cache@v4
with:
path: ~/Library/Caches/Homebrew
key: ${{ runner.os }}-brew
- name: Install homebrew dependencies
if: matrix.test-type == 'functional'
run: |
brew install xcodegen make libtool zlib autoconf automake ninja
- name: Cache CMake and Bazel installations
if: matrix.test-type == 'functional'
id: cache-tools
uses: actions/cache@v4
with:
path: |
~/Applications/CMake/3.15.7
~/Applications/CMake/3.19.7
~/Applications/CMake/3.23.5
~/Applications/bazel/6.3.2
~/Applications/bazel/7.1.2
key: ${{ runner.os }}-conan-tools-cache
- name: Build CMake old versions not available for ARM
if: matrix.test-type == 'functional' && steps.cache-tools.outputs.cache-hit != 'true'
run: |
set -e
CMAKE_BUILD_VERSIONS=("3.15.7")
for version in "${CMAKE_BUILD_VERSIONS[@]}"; do
echo "Compiling CMake version ${version} from source for ARM..."
wget -q --no-check-certificate https://cmake.org/files/v${version%.*}/cmake-${version}.tar.gz
tar -xzf cmake-${version}.tar.gz
cd cmake-${version}
mkdir build && cd build
../bootstrap --prefix=${HOME}/Applications/CMake/${version} -- -DCMAKE_USE_OPENSSL=ON
make -j$(sysctl -n hw.ncpu)
make install
${HOME}/Applications/CMake/${version}/bin/cmake --version
cd ../../
rm -rf cmake-${version} cmake-${version}.tar.gz
done
- name: Install universal CMake versions
if: matrix.test-type == 'functional' && steps.cache-tools.outputs.cache-hit != 'true'
run: |
set -e
CMAKE_PRECOMP_VERSIONS=("3.19.7" "3.23.5")
for version in "${CMAKE_PRECOMP_VERSIONS[@]}"; do
echo "Downloading and installing precompiled universal CMake version ${version}..."
wget -q --no-check-certificate https://cmake.org/files/v${version%.*}/cmake-${version}-macos-universal.tar.gz
tar -xzf cmake-${version}-macos-universal.tar.gz \
--exclude=CMake.app/Contents/bin/cmake-gui \
--exclude=CMake.app/Contents/doc/cmake \
--exclude=CMake.app/Contents/share/cmake-${version%.*}/Help \
--exclude=CMake.app/Contents/share/vim
mkdir -p ${HOME}/Applications/CMake/${version}
cp -fR cmake-${version}-macos-universal/CMake.app/Contents/* ${HOME}/Applications/CMake/${version}
${HOME}/Applications/CMake/${version}/bin/cmake --version
rm -rf cmake-${version}-macos-universal
rm cmake-${version}-macos-universal.tar.gz
done
- name: Install Bazel versions
if: matrix.test-type == 'functional' && steps.cache-tools.outputs.cache-hit != 'true'
run: |
set -e
for version in 6.3.2 7.1.2; do
mkdir -p ${HOME}/Applications/bazel/${version}
wget -q -O ${HOME}/Applications/bazel/${version}/bazel https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-darwin-arm64
chmod +x ${HOME}/Applications/bazel/${version}/bazel
done
- name: Run Tests
run: |
NUM_CPUS=$(sysctl -n hw.ncpu)
echo "Number of CPUs available: $NUM_CPUS"
if [ "${{ matrix.test-type }}" == "unittests" ]; then
pytest test/unittests --durations=20 -n $NUM_CPUS
elif [ "${{ matrix.test-type }}" == "integration" ]; then
pytest test/integration --durations=20 -n $NUM_CPUS
elif [ "${{ matrix.test-type }}" == "functional" ]; then
export PATH=${HOME}/Applications/CMake/3.15.7/bin:$PATH:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin
cmake --version
pytest test/functional --durations=20 -n $NUM_CPUS
fi