-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (154 loc) · 6.18 KB
/
macos.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Copyright (c) 2021-2024 [Ribose Inc](https://www.ribose.com).
# All rights reserved.
# This file is a part of tamatebako
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The purpose of this workflow is to check that build procedures work correctly
# in specific environment. Due to this reason there is no caching. It is done by
# intention. All caching is in upstream projects.
name: MacOS
on:
schedule:
- cron: "0 7 * * 0"
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- '**.adoc'
- '**.md'
- '.cirrus.yml'
- '.github/workflows/*.yml'
- '!.github/workflows/macos.yml'
pull_request:
paths-ignore:
- 'docs/**'
- '**.adoc'
- '**.md'
- '.cirrus.yml'
- '.github/workflows/*.yml'
- '!.github/workflows/macos.yml'
workflow_dispatch:
concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
env:
CACHE_VER: 5
jobs:
build:
name: ${{ matrix.env.os }} [XCode ${{ matrix.env.xcode }}, ASAN ${{ matrix.env.ASAN }}, COVERAGE ${{ matrix.env.COVERAGE }}, ${{ matrix.env.LOG_LEVEL }} ]
runs-on: ${{ matrix.env.os }}
strategy:
fail-fast: false
matrix:
env:
- { os: 'macos-12', arch: 'x86_64', ASAN: 'OFF', COVERAGE: 'OFF', LOG_LEVEL: 'warn', xcode: '13.1' }
- { os: 'macos-14', arch: 'arm64', ASAN: 'OFF', COVERAGE: 'OFF', LOG_LEVEL: 'warn', xcode: '14.3.1', LG_VADDR: 39 }
- { os: 'macos-14', arch: 'arm64', ASAN: 'OFF', COVERAGE: 'OFF', LOG_LEVEL: 'warn', xcode: '15.4' }
env: ${{ matrix.env }}
steps:
- name: Setup XCode ${{ matrix.env.xcode }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.env.xcode }}
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup environment
run: |
cat common.env macos-${{ matrix.env.arch }}.env >> $GITHUB_ENV
echo "CORES=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
echo "MAKEFLAGS=j$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
- name: Create deps folder
run: |
mkdir ${{ github.workspace }}/${{ env.DEPS }}
echo 'BREW_HOME<<EOF' >> $GITHUB_ENV
brew --prefix >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Process cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/${{ env.DEPS }}
key: ${{ matrix.env.os }}-${{ matrix.env.xcode }}-${{ hashFiles('**/common.env') }}-${{ env.ASAN }}-${{ env.COVERAGE }}-${{ env.LOG_LEVEL }}-v${{ env.CACHE_VER }}
- name: Install zlib
if: matrix.env.os == 'macos-14'
run: |
brew install zlib bison boost
brew reinstall xz
- name: Install packages
# Already installed: openssl, libevent, libsodium, lz4, xz
# Not installing [comparing to ubuntu as a baseline] libiberty, libunwind, libdwarf, libelf
run: brew install flex gnu-sed bash double-conversion jemalloc fmt glog googletest
- name: Configure
run: |
cmake -B build -DPREFER_SYSTEM_GTEST=ON -DWITH_TESTS=ON -DWITH_ASAN=${{ env.ASAN }} -DWITH_COVERAGE=${{ env.COVERAGE }} -DTESTS_LOG_LEVEL=${{ env.LOG_LEVEL }}
- name: Build
run: cmake --build build --parallel "$CORES"
- name: Run unit tests
run: ctest --test-dir build --output-on-failure --parallel "$CORES"
- name: Checkout shell test framework
if: ${{ env.COVERAGE != 'ON' && env.ASAN != 'ON' }}
uses: actions/checkout@v4
with:
repository: kward/shunit2
path: ${{ github.workspace }}/tests/shunit2
fetch-depth: 1
- name: Run additional tests
if: ${{ env.COVERAGE != 'ON' && env.ASAN != 'ON' }}
run: ${{ env.BREW_HOME }}/bin/bash ${{ github.workspace }}/tests/scripts/tests.sh
- name: Upload tests
if: ${{ env.COVERAGE != 'ON' && env.ASAN != 'ON' && env.os == 'macos-12' }}
uses: actions/upload-artifact@v4
with:
name: tests
retention-days: 1
path: |
${{github.workspace}}/build/wr-bin
${{github.workspace}}/build/wr-tests
${{github.workspace}}/build/fs2.bin
test-on-macos-13-and-14:
# The run on MacOS 14 is the amd64 on arm64 test
needs: build
name: run tests on MacOS-13/14
runs-on: ${{ matrix.os }}
env:
TEBAKO_CROSS_TEST: ON
strategy:
fail-fast: false
matrix:
os: [ macos-13, macos-14 ]
steps:
- name: Download tests
uses: actions/download-artifact@v4
with:
name: tests
- name: Provision execute permissions
run: |
chmod +x wr-bin
chmod +x wr-tests
mkdir -p build
mv fs2.bin build/fs2.bin
- name: Run statically linked application
run: ./wr-bin
- name: Run unit tests
run: ./wr-tests