Skip to content

Commit

Permalink
Add CI job to build nativeruntime for Windows
Browse files Browse the repository at this point in the history
Signed-off-by: utzcoz <utzcoz@outlook.com>
  • Loading branch information
utzcoz committed Jan 4, 2022
1 parent 0e50141 commit 78fabaf
Showing 1 changed file with 67 additions and 10 deletions.
77 changes: 67 additions & 10 deletions .github/workflows/build_native_runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,56 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-latest, self-hosted]
os: [ubuntu-18.04, macos-latest, self-hosted, windows-2019]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive

- name: Set up JDK 11.0.8
# msys2 only log not fail on non-Windows platform.
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: true
platform-check-severity: warn
location: D:\
install: >-
make
mingw-w64-x86_64-gcc
mingw-w64-x86_64-ninja
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11.0.8
java-version: 11

- name: Install Ninja (Mac OS)
if: runner.os =='macOS'
- name: Install build tools (Mac OS)
if: runner.os == 'macOS'
run: brew install ninja

- name: Install Ninja (Linux)
if: runner.os =='Linux'
- name: Install build tools (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install ninja-build

- name: Cache ICU build output
- name: Cache ICU build output (Non Windows)
id: cache-icu
uses: actions/cache@v2
if: runner.os == 'Linux' || runner.os == 'macOS'
with:
path: ~/icu-bin
key: ${{ runner.os }}-${{ runner.arch }}-icu-${{ hashFiles('nativeruntime/external/icu/**') }}

- name: Cache ICU build output (Windows)
id: cache-icu-windows
uses: actions/cache@v2
if: runner.os == 'Windows'
with:
path: D:\msys64\home\runneradmin\icu-bin
key: ${{ runner.os }}-${{ runner.arch }}-icu-windows-${{ hashFiles('nativeruntime/external/icu/**') }}

- name: Build ICU for MacOS
if: runner.os =='macOS' && steps.cache-icu.outputs.cache-hit != 'true'
run: |
Expand All @@ -57,7 +80,26 @@ jobs:
make -j4
make install
- name: Run CMake
- name: Build ICU for Windows
if: runner.os == 'Windows' && steps.cache-icu-windows.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
cd nativeruntime/external/icu/icu4c/source
./runConfigureICU MinGW --enable-static --prefix=$HOME/icu-bin
make -j4
make install
- name: Run CMake (Non Windows)
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
mkdir build
cd build
ICU_ROOT_DIR=$HOME/icu-bin cmake -B . -S ../nativeruntime/cpp -G Ninja
ninja
- name: Run CMake (Windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
mkdir build
cd build
Expand All @@ -76,9 +118,24 @@ jobs:
echo "NATIVERUNTIME_ARTIFACT_FILE=librobolectric-nativeruntime-mac-$(uname -m).dylib" >> $GITHUB_ENV
mv build/libnativeruntime.dylib build/librobolectric-nativeruntime-mac-$(uname -m).dylib
- name: Upload libnativeruntime
- name: Rename libnativeruntime for Windows
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
mv build/libnativeruntime.dll build/robolectric-nativeruntime-windows-x86_64.dll
- name: Upload libnativeruntime (Non Windows)
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: actions/upload-artifact@v2
with:
name: ${{env.NATIVERUNTIME_ARTIFACT_FILE}}
path: |
build/${{env.NATIVERUNTIME_ARTIFACT_FILE}}
- name: Upload libnativeruntime (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v2
with:
name: robolectric-nativeruntime-windows-x86_64.dll
path: |
build/robolectric-nativeruntime-windows-x86_64.dll

0 comments on commit 78fabaf

Please sign in to comment.