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 Dec 10, 2021
1 parent 9af48c1 commit 031071b
Showing 1 changed file with 47 additions and 9 deletions.
56 changes: 47 additions & 9 deletions .github/workflows/build_native_runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,44 @@ 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
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
id: cache-icu
uses: actions/cache@v2
with:
path: ~/icu-bin
path: $HOME/icu-bin
key: ${{ runner.os }}-${{ runner.arch }}-icu-${{ hashFiles('nativeruntime/external/icu/**') }}

- name: Build ICU for MacOS
Expand All @@ -61,7 +74,26 @@ jobs:
make -j4
make install
- name: Run CMake
- name: Build ICU for Windows
if: runner.os == 'Windows' && steps.cache-icu.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 @@ -80,6 +112,12 @@ 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: Rename libnativeruntime for Windows
if: runner.os == 'Windows'
run: |
echo "NATIVERUNTIME_ARTIFACT_FILE=robolectric-nativeruntime-windows-x86_64.dll" >> $GITHUB_ENV
mv build/libnativeruntime.dll build/robolectric-nativeruntime-windows-x86_64.dll
- name: Upload libnativeruntime
uses: actions/upload-artifact@v2
with:
Expand Down

0 comments on commit 031071b

Please sign in to comment.