Skip to content

Commit

Permalink
Refactor workflow files (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
maroontress-tomohisa authored Sep 2, 2023
1 parent 9b494d8 commit 446e09b
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 172 deletions.
175 changes: 81 additions & 94 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,58 +19,45 @@ jobs:
runs-on: ${{matrix.os}}

steps:
- name: Set up env
shell: bash
run: |
echo home_bin="$HOME/bin" >> "$GITHUB_ENV"
echo ninja="$HOME/bin/ninja" >> "$GITHUB_ENV"
- name: Set up on Windows
if: runner.os == 'Windows'
shell: bash
run: |
echo ninja_zip="ninja-win.zip" >> "$GITHUB_ENV"
echo android_ndk="$(cygpath -u $ANDROID_NDK)" >> "$GITHUB_ENV"
- name: Set up on Linux
if: runner.os == 'Linux'
run: |
echo ninja_zip="ninja-linux.zip" >> "$GITHUB_ENV"
echo android_ndk="$ANDROID_NDK" >> "$GITHUB_ENV"
- name: Set up on macOS
if: runner.os == 'macOS'
run: |
echo ninja_zip="ninja-mac.zip" >> "$GITHUB_ENV"
echo android_ndk="$ANDROID_NDK" >> "$GITHUB_ENV"
- name: Install ninja
shell: bash
run: |
mkdir -p ${{env.home_bin}}
curl -L -o ninja.zip "https://github.com/ninja-build/ninja/releases/download/v1.11.1/${{env.ninja_zip}}"
unzip ninja.zip -d ${{env.home_bin}}
- name: Set up on Windows
if: runner.os == 'Windows'
shell: bash
run: |
echo NINJA_ZIP="ninja-win.zip" >> "$GITHUB_ENV"
echo ANDROID_NDK="$(cygpath -u $ANDROID_NDK)" >> "$GITHUB_ENV"
- name: Set up on Linux
if: runner.os == 'Linux'
run: echo NINJA_ZIP="ninja-linux.zip" >> "$GITHUB_ENV"
- name: Set up on macOS
if: runner.os == 'macOS'
run: echo NINJA_ZIP="ninja-mac.zip" >> "$GITHUB_ENV"
- name: Install ninja
shell: bash
run: |
mkdir -p "$HOME/bin"
curl -L -o ninja.zip "https://github.com/ninja-build/ninja/releases/download/v1.11.1/$NINJA_ZIP"
unzip ninja.zip -d "$HOME/bin"
- uses: actions/checkout@v3
with:
submodules: true
- name: Configure ${{matrix.abi}}
shell: bash
run: |
sh android.sh build configure ${{matrix.abi}} \
-G Ninja -DCMAKE_MAKE_PROGRAM=${{env.ninja}} \
-DCMAKE_INSTALL_PREFIX:PATH="$HOME/android/${{matrix.abi}}"
env:
ANDROID_NDK: ${{env.android_ndk}}
- name: Build ${{matrix.abi}}
shell: bash
run: |
cmake --build build/${{matrix.abi}} --config Release -v
- name: Install ${{matrix.abi}}
shell: bash
run: |
cmake --install build/${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: android-${{matrix.os}}
path: ~/android/
- uses: actions/checkout@v3
with:
submodules: true
- name: Configure ${{matrix.abi}}
shell: bash
run: |
sh android.sh build configure ${{matrix.abi}} \
-G Ninja -DCMAKE_MAKE_PROGRAM="$HOME/bin/ninja" \
-DCMAKE_INSTALL_PREFIX:PATH="$HOME/android/${{matrix.abi}}"
- name: Build ${{matrix.abi}}
shell: bash
run: cmake --build build/${{matrix.abi}} --config Release -v
- name: Install ${{matrix.abi}}
shell: bash
run: cmake --install build/${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: android-${{matrix.os}}
path: ~/android/

test:
timeout-minutes: 30
Expand All @@ -81,46 +68,46 @@ jobs:
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Configure ${{matrix.abi}}
run: |
sh android.sh build configure ${{matrix.abi}}
- name: Build ${{matrix.abi}}
run: |
cmake --build build/${{matrix.abi}} --config Release -v
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: hostos-${{matrix.os}}-api-21-abi-${{matrix.abi}}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-options: -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none
api-level: 21
arch: ${{matrix.abi}}
ndk: 25.2.9519653
force-avd-creation: false
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none
api-level: 21
arch: ${{matrix.abi}}
ndk: 25.2.9519653
force-avd-creation: false
disable-animations: true
script: sh android.sh build test ${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: android-testsuite-${{matrix.os}}-${{matrix.abi}}
path: build/${{matrix.abi}}/testsuite/log.txt
- uses: actions/checkout@v3
with:
submodules: true
- name: Configure ${{matrix.abi}}
run: |
sh android.sh build configure ${{matrix.abi}}
- name: Build ${{matrix.abi}}
run: |
cmake --build build/${{matrix.abi}} --config Release -v
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: hostos-${{matrix.os}}-api-21-abi-${{matrix.abi}}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-options: -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none
api-level: 21
arch: ${{matrix.abi}}
ndk: 25.2.9519653
force-avd-creation: false
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none
api-level: 21
arch: ${{matrix.abi}}
ndk: 25.2.9519653
force-avd-creation: false
disable-animations: true
script: sh android.sh build test ${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: android-testsuite-${{matrix.os}}-${{matrix.abi}}
path: build/${{matrix.abi}}/testsuite/log.txt
21 changes: 12 additions & 9 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ jobs:
runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/checkout@v3
with:
submodules: true

- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Configure CMake
shell: bash
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}}
- name: Build
shell: bash
run: cmake --build build --config $BUILD_TYPE

- name: Test
run: ctest --test-dir build -C ${{env.BUILD_TYPE}} -V
- name: Test
shell: bash
run: ctest --test-dir build -C $BUILD_TYPE -V
138 changes: 69 additions & 69 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,82 +22,82 @@ jobs:
- abi: x86_64
sdk: iphoneos
steps:
- name: get-cmake
uses: lukka/[email protected]
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Build ${{matrix.abi}}
run: |
sh ios.sh build build-non-fat ${{matrix.sdk}} ${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: build
if-no-files-found: error
- name: get-cmake
uses: lukka/[email protected]
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Build ${{matrix.abi}}
run: |
sh ios.sh build build-non-fat ${{matrix.sdk}} ${{matrix.abi}}
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: build
if-no-files-found: error
install_and_test:
runs-on: macos-latest
timeout-minutes: 30
needs: build_non_fat
steps:
- name: get-cmake
uses: lukka/[email protected]
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Run simulator
run: |
runtime=$(xcrun simctl list runtimes iOS -j | jq '.runtimes[].identifier' | tail -1)
udid=$(xcrun simctl list devices iPhone available -j | jq '.devices['$runtime']|.[].udid' | tail -1)
xcrun simctl bootstatus $(eval echo $udid) -b
- name: Test
run: |
ctest --test-dir build/iphonesimulator-x86_64 -C Release
- name: Archive artifacts (testsuite)
if: ${{failure()}}
uses: actions/upload-artifact@v3
with:
name: testsuite
path: ${{github.workspace}}/build/iphonesimulator-x86_64/
- name: Install fat files and XCFrameworks
run: |
sh ios.sh build install "$HOME/ios"
- name: Archive artifacts (xcframework)
uses: actions/upload-artifact@v3
with:
name: xcframework
path: ~/ios
if-no-files-found: error
- name: get-cmake
uses: lukka/[email protected]
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Run simulator
run: |
runtime=$(xcrun simctl list runtimes iOS -j | jq '.runtimes[].identifier' | tail -1)
udid=$(xcrun simctl list devices iPhone available -j | jq '.devices['$runtime']|.[].udid' | tail -1)
xcrun simctl bootstatus $(eval echo $udid) -b
- name: Test
run: |
ctest --test-dir build/iphonesimulator-x86_64 -C Release
- name: Archive artifacts (testsuite)
if: ${{failure()}}
uses: actions/upload-artifact@v3
with:
name: testsuite
path: ${{github.workspace}}/build/iphonesimulator-x86_64/
- name: Install fat files and XCFrameworks
run: |
sh ios.sh build install "$HOME/ios"
- name: Archive artifacts (xcframework)
uses: actions/upload-artifact@v3
with:
name: xcframework
path: ~/ios
if-no-files-found: error
build-simply:
runs-on: macos-latest
timeout-minutes: 30
if: ${{false}}
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Configure
run: sh ios.sh build configure
- name: Build
run: sh ios.sh build build
- name: Install
run: sh ios.sh build install $HOME/ios
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: ios
path: ~/ios/
- name: Run simulator
run: |
runtime=$(xcrun simctl list runtimes iOS -j | jq '.runtimes[].identifier' | tail -1)
udid=$(xcrun simctl list devices iPhone available -j | jq '.devices['$runtime']|.[].udid' | tail -1)
xcrun simctl bootstatus $(eval echo $udid) -b
- name: Test
run: |
ctest --test-dir build/iphonesimulator-x86_64 -C Release
- uses: actions/checkout@v3
with:
submodules: true
lfs: true
- name: Configure
run: sh ios.sh build configure
- name: Build
run: sh ios.sh build build
- name: Install
run: sh ios.sh build install $HOME/ios
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: ios
path: ~/ios/
- name: Run simulator
run: |
runtime=$(xcrun simctl list runtimes iOS -j | jq '.runtimes[].identifier' | tail -1)
udid=$(xcrun simctl list devices iPhone available -j | jq '.devices['$runtime']|.[].udid' | tail -1)
xcrun simctl bootstatus $(eval echo $udid) -b
- name: Test
run: |
ctest --test-dir build/iphonesimulator-x86_64 -C Release

0 comments on commit 446e09b

Please sign in to comment.