Skip to content

Commit

Permalink
Refactorings from the AWT Font PR (#729)
Browse files Browse the repository at this point in the history
* Refactoring from AWT Font PR

Thanks, @rock3r, for refactorings! I extracted them from the AWT font PR (they were reverted in 53f00c7)

- fix formatting
- fix comments
- split CI steps

I am not sure about mikepenz/action-junit-report. Let's remove it for now (otherwise it should be investigated from functionality and security perspective)

* Refactoring from AWT Font PR

Thanks, @rock3r, for refactorings! I extracted them from the AWT font PR (they were reverted in 53f00c7)

- fix formatting
- fix comments
- split CI steps

I am not sure about mikepenz/action-junit-report. Let's remove it for now (otherwise it should be investigated from functionality and security perspective)

Also, removed implementation("pl.pragmatists:JUnitParams:1.1.1"), as it isn't used.
  • Loading branch information
igordmn authored Jun 26, 2023
1 parent 02683bc commit e3b0ef8
Show file tree
Hide file tree
Showing 23 changed files with 331 additions and 289 deletions.
226 changes: 141 additions & 85 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,110 @@
# Default Skiko CI
name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
# TODO: temporary for faster tests, restore!
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
macos:
# The type of runner that the job will run on
macos:
runs-on: macos-11
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- 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 -Pskiko.test.onci=true :skiko:awtTest
./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true :skiko:macosX64Test
./gradlew --stacktrace --info -Pskiko.native.enabled=true :skiko:publishToMavenLocal
./gradlew --stacktrace --info :SkiaAwtSample:installDist # check AWT sample works
- uses: actions/upload-artifact@v2
./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:
# The type of runner that the job will run on
ios:
runs-on: macos-11
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- 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
run: |
./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true :skiko:iosX64Test
# iosSimulatorArm64Test will build the binary but the tests will be skipped due to X64 host machine
./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true :skiko:iosSimulatorArm64Test
./gradlew --stacktrace --info -Pskiko.native.enabled=true :skiko:publishToMavenLocal
# TODO run iOS specific tests on iPhone simulator
- uses: actions/upload-artifact@v2
name: 'Compile and run iOS x64 tests'
run: ./gradlew --stacktrace --info -Pskiko.native.enabled=true -Pskiko.test.onci=true :skiko:iosX64Test

# 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:
linux:
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- 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
# Runs a set of commands using the runners shell
name: 'Set up Android SDK'

- shell: bash
name: 'Set up Linux build environment'
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
Expand All @@ -96,83 +120,115 @@ jobs:
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 &
- run: |
# Test Linux native
- 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
- run: |
# Test Linux AWT
- 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
- env:

- shell: bash
name: 'Publish to Maven Local, check AWT sample'
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
# Test publishToMavenLocal
./gradlew --no-daemon --stacktrace --info -Pkotlin.native.cacheKind.linuxX64=none :skiko:publishToMavenLocal
./gradlew --no-daemon --stacktrace --info :SkiaAwtSample:installDist # check jvm sample works
./gradlew --no-daemon --stacktrace --info :SkiaAwtSample:installDist
./gradlew --no-daemon -Pskiko.android.enabled=true :skiko:publishSkikoJvmRuntimeAndroidX64PublicationToMavenLocal :skiko:publishSkikoJvmRuntimeAndroidArm64PublicationToMavenLocal :skiko:publishAndroidPublicationToMavenLocal
- uses: actions/upload-artifact@v2
- 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 represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
# Runs a set of commands using the runners shell
- shell: bash
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
source ./emsdk_env.sh
cd ..
./gradlew --stacktrace --info -Pskiko.wasm.enabled=true -Pskiko.test.onci=true jsTest
./gradlew --stacktrace --info -Pskiko.wasm.enabled=true publishSkikoWasmRuntimePublicationToMavenLocal
- uses: actions/upload-artifact@v2
if: always()
with:
name: test-reports-js
path: ./skiko/build/reports/tests
retention-days: 5

windows:
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@v2
- uses: actions/checkout@v3
name: 'Check out code'

- uses: microsoft/setup-msbuild@v1

- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/setup-java@v2

- 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 -Pskiko.test.onci=true :skiko:awtTest
./gradlew --stacktrace --info :skiko:publishToMavenLocal
./gradlew --stacktrace --info :SkiaAwtSample:installDist # check jvm sample works
- uses: actions/upload-artifact@v2
./gradlew --stacktrace --info :SkiaAwtSample:installDist
- uses: actions/upload-artifact@v3
name: 'Save test results as artifact'
if: always()
with:
name: test-reports-windows
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
# Build Skiko documentation
name: Doc

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
# Temporary, for testing. Remove!
#pull_request:
# branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# See https://github.com/marketplace/actions/deploy-to-github-pages
jobs:
dokka:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v3
name: 'Check out code'

- uses: actions/setup-java@v3
name: 'Set up JDK 11'
with:
distribution: 'adopt'
java-version: '11'
- name: Build docs
run: bash -c 'JAVA_OPTS="-Xmx4g" ./gradlew --no-daemon -Pskiko.native.enabled=true -Pskiko.wasm.enabled=true -Pskiko.android.enabled=true :skiko:dokkaHtml'
- name: Publish documentation
cache: 'gradle'

- name: 'Build Dokka documentation'
run: bash -c 'JAVA_OPTS="-Xmx4g" ./gradlew --no-daemon -Pskiko.native.enabled=true -Pskiko.wasm.enabled=true -Pskiko.android.enabled=true :skiko:dokkaHtml'

- name: 'Publish documentation'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: ./skiko/build/dokka/html
FOLDER: ./skiko/build/dokka/html
3 changes: 3 additions & 0 deletions skiko/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ build
local.properties
.DS_Store
dependencies/

# Screenshot test actual files
**/src/**/screenshots/*_actual.png
10 changes: 7 additions & 3 deletions skiko/.run/awtTest.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="awtTest -Dskiko.test.ui.enabled=true -Dskiko.test.ui.renderApi=all" />
<option name="scriptParameters" value="-Dskiko.test.ui.enabled=true -Dskiko.test.ui.renderApi=all" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
<list>
<option value=":awtTest" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion skiko/.run/publishToMavenLocal.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</option>
<option name="taskNames">
<list>
<option value="publishToMavenLocal" />
<option value=":publishToMavenLocal" />
</list>
</option>
<option name="vmOptions" value="" />
Expand Down
Loading

0 comments on commit e3b0ef8

Please sign in to comment.