Skip to content

Commit

Permalink
Add macOS ci
Browse files Browse the repository at this point in the history
  • Loading branch information
leiyanfei committed Mar 13, 2024
1 parent 3650de7 commit 24cb1ab
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .github/actions/build-folly/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: build-folly
runs:
using: composite
steps:
- name: Build folly and dependencies
run: make build_folly
shell: bash
10 changes: 10 additions & 0 deletions .github/actions/increase-max-open-files-on-macos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: increase-max-open-files-on-macos
runs:
using: composite
steps:
- name: Increase max open files
run: |-
sudo sysctl -w kern.maxfiles=1048576
sudo sysctl -w kern.maxfilesperproc=1048576
sudo launchctl limit maxfiles 1048576
shell: bash
7 changes: 7 additions & 0 deletions .github/actions/install-gflags-on-macos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: install-gflags-on-macos
runs:
using: composite
steps:
- name: Install gflags on macos
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install gflags
shell: bash
9 changes: 9 additions & 0 deletions .github/actions/install-jdk8-on-macos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: install-jdk8-on-macos
runs:
using: composite
steps:
- name: Install JDK 8 on macos
run: |-
HOMEBREW_NO_AUTO_UPDATE=1 brew tap bell-sw/liberica
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask liberica-jdk8
shell: bash
5 changes: 5 additions & 0 deletions .github/actions/pre-steps-macos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: pre-steps-macos
runs:
using: composite
steps:
- uses: "./.github/actions/pre-steps"
7 changes: 7 additions & 0 deletions .github/actions/setup-folly/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: setup-folly
runs:
using: composite
steps:
- name: Checkout folly sources
run: make checkout_folly
shell: bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:
- uses: actions/[email protected]
- uses: "./.github/actions/pre-steps"
- uses: "./.github/actions/install-gflags"
- run: make V=1 J=8 -j8 check
- run: echo "JAVA_HOME=${JAVA_HOME}"
- run: DISABLE_WARNING_AS_ERROR=1 make V=1 J=8 -j8 check
- uses: "./.github/actions/post-steps"
# ======================== Linux No Test Runs ======================= #
build-linux-release:
Expand All @@ -39,20 +40,22 @@ jobs:
steps:
- uses: actions/[email protected]
- uses: "./.github/actions/install-gflags"
- run: make V=1 -j32 LIB_MODE=shared release
- run: echo "JAVA_HOME=${JAVA_HOME}"
- run: echo 'export PATH=$JAVA_HOME/bin:$PATH' >> $GITHUB_PATH
- run: DISABLE_WARNING_AS_ERROR=1 make V=1 -j32 LIB_MODE=shared release
- run: ls librocksdb.so
- run: "./db_stress --version"
- run: make clean
- run: make V=1 -j32 release
- run: DISABLE_WARNING_AS_ERROR=1 make clean
- run: DISABLE_WARNING_AS_ERROR=1 make V=1 -j32 release
- run: ls librocksdb.a
- run: "./db_stress --version"
- run: make clean
- run: DISABLE_WARNING_AS_ERROR=1 make clean
- run: sudo apt-get remove -y libgflags-dev
- run: make V=1 -j32 LIB_MODE=shared release
- run: DISABLE_WARNING_AS_ERROR=1 make V=1 -j32 LIB_MODE=shared release
- run: ls librocksdb.so
- run: if ./db_stress --version; then false; else true; fi
- run: make clean
- run: make V=1 -j32 release
- run: DISABLE_WARNING_AS_ERROR=1 make clean
- run: DISABLE_WARNING_AS_ERROR=1 make V=1 -j32 release
- run: ls librocksdb.a
- run: if ./db_stress --version; then false; else true; fi
- uses: "./.github/actions/post-steps"
Expand All @@ -76,10 +79,11 @@ jobs:
- name: Set Java Environment
run: |-
echo "JAVA_HOME=${JAVA_HOME}"
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> $GITHUB_PATH
which java && java -version
which javac && javac -version
- name: Test RocksDBJava
run: scl enable devtoolset-7 'make V=1 J=8 -j8 jtest'
run: scl enable devtoolset-7 'DISABLE_WARNING_AS_ERROR=1 make V=1 J=8 -j8 jtest'
# NOTE: post-steps skipped because of compatibility issues with docker image
build-linux-java-static:
runs-on: ubuntu-latest
Expand All @@ -103,5 +107,67 @@ jobs:
which java && java -version
which javac && javac -version
- name: Build RocksDBJava Static Library
run: scl enable devtoolset-7 'make V=1 J=8 -j8 rocksdbjavastatic'
# NOTE: post-steps skipped because of compatibility issues with docker image
run: scl enable devtoolset-7 'DISABLE_WARNING_AS_ERROR=1 make V=1 J=8 -j8 rocksdbjavastatic'
# NOTE: post-steps skipped because of compatibility issues with docker image

# ========================= MacOS build only ======================== #
build-macos:
runs-on: macos-13
timeout-minutes: 120
env:
ROCKSDB_DISABLE_JEMALLOC: 1
steps:
- uses: actions/[email protected]
- uses: maxim-lobanov/[email protected]
with:
xcode-version: 14.3.1
- uses: "./.github/actions/increase-max-open-files-on-macos"
- uses: "./.github/actions/install-gflags-on-macos"
- uses: "./.github/actions/pre-steps-macos"
- name: Build
run: ulimit -S -n `ulimit -H -n` && DISABLE_WARNING_AS_ERROR=1 make V=1 J=16 -j16 all
- uses: "./.github/actions/post-steps"
# ========================= MacOS with java ======================== #
build-macos-java:
runs-on: macos-13
env:
JAVA_HOME: "/Library/Java/JavaVirtualMachines/liberica-jdk-8.jdk/Contents/Home"
ROCKSDB_DISABLE_JEMALLOC: 1
steps:
- uses: actions/[email protected]
- uses: maxim-lobanov/[email protected]
with:
xcode-version: 14.3.1
- uses: "./.github/actions/increase-max-open-files-on-macos"
- uses: "./.github/actions/install-gflags-on-macos"
- uses: "./.github/actions/install-jdk8-on-macos"
- uses: "./.github/actions/pre-steps-macos"
- name: Set Java Environment
run: |-
echo "JAVA_HOME=${JAVA_HOME}"
which java && java -version
which javac && javac -version
- name: Test RocksDBJava
run: DISABLE_WARNING_AS_ERROR=1 make V=1 J=16 -j16 jtest
- uses: "./.github/actions/post-steps"
build-macos-java-static:
runs-on: macos-13
env:
JAVA_HOME: "/Library/Java/JavaVirtualMachines/liberica-jdk-8.jdk/Contents/Home"
steps:
- uses: actions/[email protected]
- uses: maxim-lobanov/[email protected]
with:
xcode-version: 14.3.1
- uses: "./.github/actions/increase-max-open-files-on-macos"
- uses: "./.github/actions/install-gflags-on-macos"
- uses: "./.github/actions/install-jdk8-on-macos"
- uses: "./.github/actions/pre-steps-macos"
- name: Set Java Environment
run: |-
echo "JAVA_HOME=${JAVA_HOME}"
which java && java -version
which javac && javac -version
- name: Build RocksDBJava x86 and ARM Static Libraries
run: DISABLE_WARNING_AS_ERROR=1 make V=1 J=16 -j16 rocksdbjavastaticosx
- uses: "./.github/actions/post-steps"
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ BASH_EXISTS := $(shell which bash)
SHELL := $(shell which bash)
include common.mk

MY_JAVA_INCLUDE = -I$(JAVA_HOME)/include/ -I$(JAVA_HOME)/include/linux
ifneq ("$(wildcard $(JAVA_HOME)/include/darwin)","")
MY_JAVA_INCLUDE = -I$(JAVA_HOME)/include -I $(JAVA_HOME)/include/darwin
endif

CLEAN_FILES = # deliberately empty, so we can append below.
CFLAGS += ${EXTRA_CFLAGS}
CXXFLAGS += ${EXTRA_CXXFLAGS}
CXXFLAGS += ${MY_JAVA_INCLUDE}
LDFLAGS += $(EXTRA_LDFLAGS)
MACHINE ?= $(shell uname -m)
ARFLAGS = ${EXTRA_ARFLAGS} rs
Expand Down
2 changes: 0 additions & 2 deletions java/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,6 @@ javalib: java java_test javadocs
java: java-version
$(AM_V_GEN)mkdir -p $(MAIN_CLASSES)
$(AM_V_at) $(JAVAC_CMD) $(JAVAC_ARGS) -h $(NATIVE_INCLUDE) -d $(MAIN_CLASSES) $(SOURCES)
$(AM_V_at)@cp ../HISTORY.md ./HISTORY-CPP.md
$(AM_V_at)@rm -f ./HISTORY-CPP.md

sample: java
$(AM_V_GEN)mkdir -p $(SAMPLES_MAIN_CLASSES)
Expand Down

0 comments on commit 24cb1ab

Please sign in to comment.