Skip to content

Commit 90a8f03

Browse files
authored
Merge pull request #5 from postmanlabs/ci-macos-and-windows
ci: add executors for macOS and Windows
2 parents 6197192 + f63d261 commit 90a8f03

File tree

3 files changed

+68
-26
lines changed

3 files changed

+68
-26
lines changed

.circleci/config.yml

+63-20
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ version: 2.1
33
common_parameters: &common_parameters
44
os:
55
type: enum
6-
enum: [ alpine, debian, linux ]
6+
enum: [ alpine, debian, linux, macos, "win/default" ]
7+
8+
## ORBS ##
9+
10+
orbs:
11+
win: circleci/[email protected]
712

813
## EXECUTORS ##
914

@@ -23,6 +28,11 @@ executors:
2328
machine:
2429
image: ubuntu-2004:202101-01
2530

31+
macos:
32+
resource_class: medium
33+
macos:
34+
xcode: 13.4.1
35+
2636
## COMMANDS ##
2737

2838
commands:
@@ -45,23 +55,50 @@ commands:
4555
steps:
4656
- run: apt-get update -y && apt-get install -y make
4757

48-
- run: make install-deps EXECUTOR=<< parameters.os >>
58+
- when:
59+
condition:
60+
not:
61+
equal: [ "win/default", << parameters.os >> ]
62+
steps:
63+
- run: make install-deps EXECUTOR=<< parameters.os >>
64+
65+
- when:
66+
condition:
67+
equal: [ "win/default", << parameters.os >> ]
68+
steps:
69+
- run: choco install cmake.install --installargs '"ADD_CMAKE_TO_PATH=User"'
70+
- run: choco install ninja
4971

5072
build:
73+
parameters:
74+
<<: *common_parameters
5175
steps:
52-
- run:
53-
# NOTE: the circle ci container executor reports the memory/cpu stats
54-
# of the host machine (https://ideas.circleci.com/ideas/CCI-I-578),
55-
# `nproc` will return 36 on docker/medium resource_class,
56-
# ninja parallelizes accordingly, which leads to overloading
57-
# and circleci eventually terminating the builds:
58-
#
59-
# ninja: job failed: /usr/bin/c++ [...]
60-
# c++: fatal error: Killed signal terminated program cc1plus
61-
# compilation terminated
62-
#
63-
# force overwrite job count here:
64-
command: make lief JOBS=3
76+
- when:
77+
condition:
78+
not:
79+
equal: [ "win/default", << parameters.os >> ]
80+
steps:
81+
- run:
82+
# NOTE: the circle ci container executor reports the memory/cpu stats
83+
# of the host machine (https://ideas.circleci.com/ideas/CCI-I-578),
84+
# `nproc` will return 36 on docker/medium resource_class,
85+
# ninja parallelizes accordingly, which leads to overloading
86+
# and circleci eventually terminating the builds:
87+
#
88+
# ninja: job failed: /usr/bin/c++ [...]
89+
# c++: fatal error: Killed signal terminated program cc1plus
90+
# compilation terminated
91+
#
92+
# force overwrite job count here:
93+
command: make lief JOBS=3
94+
95+
- when:
96+
condition:
97+
equal: [ "win/default", << parameters.os >> ]
98+
steps:
99+
- run:
100+
command: refreshenv & cd vendor\lief & python ./setup.py --ninja build_ext -b ..\..\dist\lief
101+
shell: cmd.exe
65102

66103
- persist_to_workspace:
67104
root: .
@@ -86,7 +123,8 @@ jobs:
86123
- checkout
87124
- prepare:
88125
os: << parameters.os >>
89-
- build
126+
- build:
127+
os: << parameters.os >>
90128
- store_artifacts:
91129
path: dist
92130
- store_artifacts:
@@ -106,17 +144,22 @@ jobs:
106144

107145
## WORKFLOWS ##
108146

109-
matrix: &matrix
147+
build_matrix: &build_matrix
148+
matrix:
149+
parameters:
150+
os: [ alpine, debian, macos, "win/default" ]
151+
152+
test_matrix: &test_matrix
110153
matrix:
111154
parameters:
112-
os: [ alpine, debian ]
155+
os: [ alpine, debian, macos ]
113156

114157
workflows:
115158
postject:
116159
jobs:
117160
- build:
118-
<<: *matrix
161+
<<: *build_matrix
119162
- test:
120-
<<: *matrix
163+
<<: *test_matrix
121164
requires: [ build-<<matrix.os>> ]
122165

build/deps.mk

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ ifeq ($(EXECUTOR), alpine)
1616
build-base ninja cmake \
1717
python3 python3-dev py3-setuptools
1818
endif
19+
ifeq ($(EXECUTOR), macos)
20+
brew install cmake
21+
endif

build/system.mk

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@ ifndef OS
33

44
ifeq ($(shell uname), Linux)
55
OS = linux
6-
endif
7-
8-
ifeq ($(shell uname), Darwin)
6+
else ifeq ($(shell uname), Darwin)
97
OS = macos
10-
endif
11-
12-
ifeq ($(shell uname -o), Msys)
8+
else ifeq ($(shell uname -o), Msys)
139
OS = windows
1410
endif
1511

0 commit comments

Comments
 (0)