Skip to content

Commit

Permalink
Code reorganization and MacOs Preparation (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielku15 authored Oct 6, 2023
1 parent f772c6c commit 60b984e
Show file tree
Hide file tree
Showing 28 changed files with 533 additions and 211 deletions.
28 changes: 28 additions & 0 deletions .github/actions/build-jni/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Build JNI'
description: 'Builds the JNI Native library'
inputs:
architecture:
description: 'The CPU architecture for which to build the lib'
required: true
variant:
description: 'The library type to build'
required: true
target-os:
description: 'The target Operating system identifier'
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/download-artifact@v3
with:
path: dist
- run: ./build.cmd LibAlphaSkiaJni --target-os ${{ inputs.target-os }} --architecture ${{ inputs.architecture }} --variant ${{ inputs.variant }}
- uses: actions/upload-artifact@v3
with:
name: alphaskia-${{ inputs.target-os }}-jni-${{ inputs.architecture }}-${{ inputs.variant }}
path: artifacts

42 changes: 42 additions & 0 deletions .github/actions/build-skia/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Build Skia'
description: 'Builds the Skia Native library'
inputs:
use-cache:
description: 'Whether to try using the pre-compiled binary from the cache.'
required: false
default: 'false'
architecture:
description: 'The CPU architecture for which to build the lib'
required: true
variant:
description: 'The library type to build'
required: true
target-os:
description: 'The target Operating system identifier'
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v3
with:
submodules: false

- uses: actions/cache/restore@v3
if: ${{ inputs.use-cache }}
with:
path: dist
restore-keys: alphaskia-${{ inputs.target-os }}-${{ inputs.architecture }}-${{ inputs.variant }}

- run: ./build.cmd LibAlphaSkia --target-os ${{ inputs.target-os }} --architecture ${{ inputs.architecture }} --variant ${{ inputs.variant }} --use-cache ${{ inputs.use-cache }}
- uses: actions/upload-artifact@v3
with:
name: alphaskia-${{ inputs.target-os }}-${{ inputs.architecture }}-${{ inputs.variant }}
path: artifacts

- uses: actions/cache/save@v3
with:
path: dist
key: alphaskia-${{ inputs.target-os }}-${{ inputs.architecture }}-${{ inputs.variant }}-${{ github.run_id }}


138 changes: 72 additions & 66 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
on:
workflow_dispatch:
inputs:
use-skia-cache:
type: boolean
description: Use Skia Binary from cache
default: 'false'

jobs:

#
# Windows
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
architecture: [x64, x86, arm64]
variant: ['shared', 'static']

steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: ./build.cmd WindowsSkia --architecture ${{ matrix.architecture }} --variant ${{ matrix.variant }}
- uses: actions/upload-artifact@v3
- uses: ./.github/actions/build-skia
with:
name: alphaskia-windows-${{ matrix.architecture }}-${{ matrix.variant }}
path: artifacts

use-cache: ${{ inputs.use-skia-cache }}
architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: windows
windows-jni:
runs-on: windows-latest
needs: [windows]
Expand All @@ -28,20 +32,15 @@ jobs:
matrix:
architecture: [x64, x86, arm64]
variant: ['shared']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-jni
with:
submodules: true
- uses: actions/download-artifact@v3
with:
path: dist
- run: ./build.cmd WindowsJni --architecture ${{ matrix.architecture }} --variant ${{ matrix.variant }}
- uses: actions/upload-artifact@v3
with:
name: alphaskia-windows-jni-${{ matrix.architecture }}-${{ matrix.variant }}
path: artifacts
architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: windows

#
# Linux
linux:
runs-on: ubuntu-latest
strategy:
Expand All @@ -51,16 +50,12 @@ jobs:
# TODO architecture: [x64, x86, arm64]
variant: ['shared', 'static']
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: ./externals/skia/tools/install_dependencies.sh
- run: ./build.sh LinuxSkia --architecture ${{ matrix.architecture }} --variant ${{ matrix.variant }}
- uses: actions/upload-artifact@v3
- uses: ./.github/actions/build-skia
with:
name: alphaskia-linux-${{ matrix.architecture }}-${{ matrix.variant }}
path: artifacts

use-cache: ${{ inputs.use-skia-cache }}
architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: linux
linux-jni:
runs-on: ubuntu-latest
needs: [linux]
Expand All @@ -70,39 +65,29 @@ jobs:
# TODO architecture: [x64, x86, arm64]
architecture: [x64]
variant: ['shared']

steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/download-artifact@v3
- uses: ./.github/actions/build-jni
with:
path: dist
- run: ./build.cmd LinuxJni --architecture ${{ matrix.architecture }} --variant ${{ matrix.variant }}
- uses: actions/upload-artifact@v3
with:
name: alphaskia-linux-jni-${{ matrix.architecture }}-${{ matrix.variant }}
path: artifacts
architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: linux

#
# Android
android:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
architecture: [x64, x86, arm, arm64]
variant: ['shared', 'static']

steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: ./externals/skia/tools/install_dependencies.sh
- run: ./build.sh AndroidSkia --architecture ${{ matrix.architecture }} --variant ${{ matrix.variant }}
- uses: actions/upload-artifact@v3
- uses: ./.github/actions/build-skia
with:
name: alphaskia-android-${{ matrix.architecture }}-${{ matrix.variant }}
path: artifacts

use-cache: ${{ inputs.use-skia-cache }}
architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: android
android-jni:
runs-on: ubuntu-latest
needs: [android]
Expand All @@ -111,23 +96,47 @@ jobs:
matrix:
architecture: [x64, x86, arm, arm64]
variant: ['shared']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-jni
with:
submodules: true
- uses: actions/download-artifact@v3
architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: android
#
# MacOs
macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
architecture: [x64, arm64]
variant: ['shared', 'static']
steps:
- uses: ./.github/actions/build-skia
with:
path: dist
- run: ./build.cmd AndroidJni --architecture ${{ matrix.architecture }} --variant ${{ matrix.variant }}
- uses: actions/upload-artifact@v3
use-cache: ${{ inputs.use-skia-cache }}
architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: macos
macos-jni:
runs-on: macos-latest
needs: [macos]
strategy:
fail-fast: false
matrix:
architecture: [x64, arm64]
variant: ['shared']
steps:
- uses: ./.github/actions/build-jni
with:
name: alphaskia-android-jni-${{ matrix.architecture }}-${{ matrix.variant }}
path: artifacts

architecture: ${{ matrix.architecture }}
variant: ${{ matrix.variant }}
target-os: macos
#
# Libraries
dotnet:
runs-on: windows-latest
needs: [windows, linux]
needs: [windows, linux, android, macos]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -145,7 +154,7 @@ jobs:
java:
runs-on: ubuntu-latest
needs: [windows-jni, linux-jni, android-jni]
needs: [windows-jni, linux-jni, android-jni, macos-jni]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -158,7 +167,4 @@ jobs:
with:
name: Jars
path: |
lib/java/main/build/libs/*.jar
lib/java/linux/build/libs/*.jar
lib/java/android/build/libs/*.jar
lib/java/windows/build/libs/*.jar
lib/java/*/build/libs/*.jar
29 changes: 27 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"Architecture": {
"type": "string",
"enum": [
"Arm",
"Arm64",
"X64",
"X86"
Expand Down Expand Up @@ -61,6 +62,9 @@
"LlvmHome": {
"type": "string"
},
"NdkPath": {
"type": "string"
},
"NinjaExe": {
"type": "string"
},
Expand Down Expand Up @@ -102,6 +106,11 @@
"items": {
"type": "string",
"enum": [
"AndroidJni",
"AndroidSkia",
"Compile",
"CompileTests",
"CompileWithCache",
"DotNet",
"DotNetBuild",
"DotNetPack",
Expand All @@ -111,11 +120,15 @@
"Java",
"LinuxJni",
"LinuxSkia",
"MacOsJni",
"MacOsSkia",
"PatchSkiaBuildFiles",
"PrepareForBuild",
"PrepareGitHubArtifacts",
"SetupDepotTools",
"WindowsJni",
"WindowsSkia"
"WindowsSkia",
"WithDependencies"
]
}
},
Expand All @@ -125,6 +138,11 @@
"items": {
"type": "string",
"enum": [
"AndroidJni",
"AndroidSkia",
"Compile",
"CompileTests",
"CompileWithCache",
"DotNet",
"DotNetBuild",
"DotNetPack",
Expand All @@ -134,14 +152,21 @@
"Java",
"LinuxJni",
"LinuxSkia",
"MacOsJni",
"MacOsSkia",
"PatchSkiaBuildFiles",
"PrepareForBuild",
"PrepareGitHubArtifacts",
"SetupDepotTools",
"WindowsJni",
"WindowsSkia"
"WindowsSkia",
"WithDependencies"
]
}
},
"use-cache": {
"type": "string"
},
"Variant": {
"type": "string",
"enum": [
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ In the initial release of the library we plan to support following platform matr
| linux-x86 ||||
| linux-arm ||||
| linux-arm64 ||||
| osx-x64 ||||
| osx-arm64 ||||
| macos-x64 ||||
| macos-arm64 ||||
| android-x64 ||| |
| android-x86 ||| |
| android-arm ||| |
Expand Down
Loading

0 comments on commit 60b984e

Please sign in to comment.