Files
skiko/.github/workflows/ci.yml
Elijah Semyonovanddima.avdeev ee58078e4f Fix MetalRedrawer being a source of leak (#771)
* Break strong cycle

* Add test proving it

* Remove dead code

* Explain test

* Add remark about two passes

* Add temporary ignore on test

* Use assertTrue instead of assertEquals

* Update test to ignore CI failure on Metal not supported

* Update test

* Refactor to reflect insight about memory model

* Add contract comment.

* Break strong reference from CADisplayLink -> MetalRedrawer

* Bind logical lifetime of MetalRedrawer to caDisplayLink

* Bind logical lifetime of MetalRedrawer to caDisplayLink

* Close skia context on MetalRedrawer dispose.

* Use `check`

* Fix tests on iOS with Metal on GitHub Actions (#783)

* iOS simulator warmup

* comment redundant for now

* sim ID

* iPhone 8

* iPhone 14

* env.IOS_SIM_UUID

* remove redundant

* one line cmd

* one line cmd

* device

* device

* property

* retry 3 times

* retry 3 times

* retry 5 times

* retry 10 times

* testMetalIosX64

* test test fails

* kotlin 1.8.20

* success test

* success test

* temp fail

* success test

* simplify

* simplify

* simplify

* Added iOS Metal tests only on MacOS

* Gradle, check targets before adding iosX64TestWithMetal task

---------

Co-authored-by: dima.avdeev <dima.avdeev@jetbrains.com>
2023-08-07 12:29:21 +02:00

245 lines
8.0 KiB
YAML

# Default Skiko CI
name: CI
env:
IOS_SIM_UUID: '9C58D5E8-9AE8-4595-A262-35CA4871E886' # https://github.com/futureware-tech/simulator-action/wiki/Devices-macos-13
on:
push:
branches: [ master ]
# TODO: temporary for faster tests, restore!
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
macos:
runs-on: macos-11
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: actions/setup-java@v3
name: 'Set up JDK 11'
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- shell: bash
name: 'Compile and run AWT tests'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true :skiko:awtTest
- shell: bash
name: 'Compile and run macOS x64 tests'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true :skiko:macosX64Test
- shell: bash
name: 'Publish to Maven Local, check AWT sample'
run: |
./gradlew --stacktrace --info -Pskiko.native.enabled=true :skiko:publishToMavenLocal
./gradlew --stacktrace --info :SkiaAwtSample:installDist
- uses: actions/upload-artifact@v3
name: 'Save test results as artifact'
if: always()
with:
name: test-reports-macos
path: ./skiko/build/reports/tests
retention-days: 5
ios:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: actions/setup-java@v3
name: 'Set up JDK 11'
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- name: 'Compile and run iOS x64 tests'
uses: nick-fields/retry@v2
with:
max_attempts: 10
timeout_minutes: 60
shell: bash
command: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true -Pskiko.iosSimulatorUUID="${{ env.IOS_SIM_UUID }}" :skiko:iosX64TestWithMetal
# iosSimulatorArm64Test will build the binary but the tests will be skipped due to X64 host machine
- shell: bash
name: 'Compile iOS arm64 tests'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true :skiko:iosSimulatorArm64Test
# TODO run iOS specific tests on iPhone simulator
- shell: bash
name: 'Publish to Maven Local'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true :skiko:publishToMavenLocal
- uses: actions/upload-artifact@v3
name: 'Save test results as artifact'
if: always()
with:
name: test-reports-macos
path: ./skiko/build/reports/tests
retention-days: 5
linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: actions/setup-java@v3
name: 'Set up JDK 11'
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- uses: nttld/setup-ndk@v1
name: 'Set up Android NDK'
id: setup-ndk
with:
ndk-version: r21e
- uses: android-actions/setup-android@v2
name: 'Set up Android SDK'
- shell: bash
name: 'Set up Linux build environment'
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
# TODO: simplify installation of compilers.
sudo apt-get update -y
sudo apt-get install build-essential software-properties-common -y
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install build-essential software-properties-common -y
sudo apt-get update
sudo apt-get install gcc-9 g++-9 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo update-alternatives --config gcc
sudo apt-get install ninja-build fontconfig libfontconfig1-dev libglu1-mesa-dev libxrandr-dev libdbus-1-dev zip xvfb -y
sudo Xvfb :0 -screen 0 1280x720x24 &
- shell: bash
name: 'Compile and run Linux x64 tests'
run: |
export DISPLAY=:0
./gradlew --no-daemon --stacktrace --info -Pskiko.native.enabled=true -Pkotlin.native.cacheKind.linuxX64=none -Pskiko.test.onci=true :skiko:linuxX64Test
- shell: bash
name: 'Compile and run AWT tests'
run: |
export DISPLAY=:0
./gradlew --no-daemon --stacktrace --info -Pskiko.native.enabled=true -Pkotlin.native.cacheKind.linuxX64=none -Pskiko.test.onci=true :skiko:awtTest
timeout-minutes: 25
- shell: bash
name: 'Publish to Maven Local, check AWT sample'
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
./gradlew --no-daemon --stacktrace --info -Pkotlin.native.cacheKind.linuxX64=none :skiko:publishToMavenLocal
./gradlew --no-daemon --stacktrace --info :SkiaAwtSample:installDist
./gradlew --no-daemon -Pskiko.android.enabled=true :skiko:publishSkikoJvmRuntimeAndroidX64PublicationToMavenLocal :skiko:publishSkikoJvmRuntimeAndroidArm64PublicationToMavenLocal :skiko:publishAndroidPublicationToMavenLocal
- uses: actions/upload-artifact@v3
name: 'Save test results as artifact'
if: always()
with:
name: test-reports-linux
path: ./skiko/build/reports/tests
retention-days: 5
js:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: actions/setup-java@v3
name: 'Set up JDK 11'
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- shell: bash
name: 'Set up JS build environment'
run: |
cd ./skiko
sudo apt-get update -y
sudo apt-get install binutils build-essential -y
sudo apt-get install software-properties-common -y
sudo apt-get install python git curl wget -y
if [ -d ./emsdk ]; then
cd ./emsdk
git pull
else
git clone https://github.com/emscripten-core/emsdk.git
cd ./emsdk
fi
./emsdk install 2.0.29
./emsdk activate 2.0.29
- shell: bash
name: 'Compile and run JS tests'
run: |
source "$(pwd)/skiko/emsdk/emsdk_env.sh"
./gradlew --stacktrace --info -Pskiko.wasm.enabled=true -Pskiko.test.onci=true :skiko:jsTest
- shell: bash
name: 'Publish WASM runtime to Maven Local'
run: |
source "$(pwd)/skiko/emsdk/emsdk_env.sh"
./gradlew --stacktrace --info -Pskiko.wasm.enabled=true :skiko:publishSkikoWasmRuntimePublicationToMavenLocal
- uses: actions/upload-artifact@v3
name: 'Save test results as artifact'
if: always()
with:
name: test-reports-js
path: ./skiko/build/reports/tests
retention-days: 5
windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
name: 'Check out code'
- uses: microsoft/setup-msbuild@v1
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/setup-java@v3
name: 'Set up JDK 11'
with:
distribution: 'adopt'
java-version: '11'
cache: 'gradle'
- shell: bash
name: 'Compile and run AWT tests'
run: ./gradlew --stacktrace --info -Pskiko.test.onci=true :skiko:awtTest
- shell: bash
name: 'Publish to Maven Local, check AWT sample'
run: |
./gradlew --stacktrace --info :skiko:publishToMavenLocal
./gradlew --stacktrace --info :SkiaAwtSample:installDist
- uses: actions/upload-artifact@v3
name: 'Save test results as artifact'
if: always()
with:
name: test-reports-windows
path: ./skiko/build/reports/tests
retention-days: 5