Skip to content

Commit

Permalink
Merge pull request #5 from postmanlabs/ci-macos-and-windows
Browse files Browse the repository at this point in the history
ci: add executors for macOS and Windows
  • Loading branch information
RaisinTen authored Sep 8, 2022
2 parents 6197192 + f63d261 commit 90a8f03
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 26 deletions.
83 changes: 63 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ version: 2.1
common_parameters: &common_parameters
os:
type: enum
enum: [ alpine, debian, linux ]
enum: [ alpine, debian, linux, macos, "win/default" ]

## ORBS ##

orbs:
win: circleci/windows@4.1.1

## EXECUTORS ##

Expand All @@ -23,6 +28,11 @@ executors:
machine:
image: ubuntu-2004:202101-01

macos:
resource_class: medium
macos:
xcode: 13.4.1

## COMMANDS ##

commands:
Expand All @@ -45,23 +55,50 @@ commands:
steps:
- run: apt-get update -y && apt-get install -y make

- run: make install-deps EXECUTOR=<< parameters.os >>
- when:
condition:
not:
equal: [ "win/default", << parameters.os >> ]
steps:
- run: make install-deps EXECUTOR=<< parameters.os >>

- when:
condition:
equal: [ "win/default", << parameters.os >> ]
steps:
- run: choco install cmake.install --installargs '"ADD_CMAKE_TO_PATH=User"'
- run: choco install ninja

build:
parameters:
<<: *common_parameters
steps:
- run:
# NOTE: the circle ci container executor reports the memory/cpu stats
# of the host machine (https://ideas.circleci.com/ideas/CCI-I-578),
# `nproc` will return 36 on docker/medium resource_class,
# ninja parallelizes accordingly, which leads to overloading
# and circleci eventually terminating the builds:
#
# ninja: job failed: /usr/bin/c++ [...]
# c++: fatal error: Killed signal terminated program cc1plus
# compilation terminated
#
# force overwrite job count here:
command: make lief JOBS=3
- when:
condition:
not:
equal: [ "win/default", << parameters.os >> ]
steps:
- run:
# NOTE: the circle ci container executor reports the memory/cpu stats
# of the host machine (https://ideas.circleci.com/ideas/CCI-I-578),
# `nproc` will return 36 on docker/medium resource_class,
# ninja parallelizes accordingly, which leads to overloading
# and circleci eventually terminating the builds:
#
# ninja: job failed: /usr/bin/c++ [...]
# c++: fatal error: Killed signal terminated program cc1plus
# compilation terminated
#
# force overwrite job count here:
command: make lief JOBS=3

- when:
condition:
equal: [ "win/default", << parameters.os >> ]
steps:
- run:
command: refreshenv & cd vendor\lief & python ./setup.py --ninja build_ext -b ..\..\dist\lief
shell: cmd.exe

- persist_to_workspace:
root: .
Expand All @@ -86,7 +123,8 @@ jobs:
- checkout
- prepare:
os: << parameters.os >>
- build
- build:
os: << parameters.os >>
- store_artifacts:
path: dist
- store_artifacts:
Expand All @@ -106,17 +144,22 @@ jobs:

## WORKFLOWS ##

matrix: &matrix
build_matrix: &build_matrix
matrix:
parameters:
os: [ alpine, debian, macos, "win/default" ]

test_matrix: &test_matrix
matrix:
parameters:
os: [ alpine, debian ]
os: [ alpine, debian, macos ]

workflows:
postject:
jobs:
- build:
<<: *matrix
<<: *build_matrix
- test:
<<: *matrix
<<: *test_matrix
requires: [ build-<<matrix.os>> ]

3 changes: 3 additions & 0 deletions build/deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ ifeq ($(EXECUTOR), alpine)
build-base ninja cmake \
python3 python3-dev py3-setuptools
endif
ifeq ($(EXECUTOR), macos)
brew install cmake
endif
8 changes: 2 additions & 6 deletions build/system.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ ifndef OS

ifeq ($(shell uname), Linux)
OS = linux
endif

ifeq ($(shell uname), Darwin)
else ifeq ($(shell uname), Darwin)
OS = macos
endif

ifeq ($(shell uname -o), Msys)
else ifeq ($(shell uname -o), Msys)
OS = windows
endif

Expand Down

0 comments on commit 90a8f03

Please sign in to comment.