Skip to content

Commit

Permalink
Merge branch 'main' into feat/dotLottie-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf authored Nov 20, 2024
2 parents d0320f3 + ca32331 commit 13c9ebc
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 87 deletions.
107 changes: 68 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,15 @@ on:
commitSHA:
description: "Commit SHA (leave blank for default branch)"
required: false
machine:
description: "Machine to run on, e.g. macos-12, ubuntu-20.04"
required: false
default: "macos-12"
appleXcodeVersion:
description: "Apple Xcode version, e.g. Xcode_13.3.1.app"
required: false
default: "Xcode_13.3.1.app"
appleMacosxSdk:
description: "Apple MacOSX SDK, e.g. MacOSX12.3"
required: false
default: "MacOSX12.3"

concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.target }}-${{ github.event.inputs.commitSHA || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ github.event.inputs.machine }}
build-apple:
runs-on: macos-12
if: github.event.inputs.target == 'apple' || github.event.inputs.target == 'all'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -48,42 +41,78 @@ jobs:

- name: Build Setup
run: make mac-setup

- name: Build Android
if: github.event.inputs.target == 'android' || github.event.inputs.target == 'all'
env:
APPLE_XCODE_APP_NAME: ${{ github.event.inputs.appleXcodeVersion }}
APPLE_MACOSX_SDK: ${{ github.event.inputs.appleMacosxSdk }}
run: make android

- name: Upload Android Artifacts
uses: actions/upload-artifact@v3
with:
name: android
path: ./release/android/*.tar.gz
TARGET: apple

- name: Build Apple
if: github.event.inputs.target == 'apple' || github.event.inputs.target == 'all'
env:
APPLE_XCODE_APP_NAME: ${{ github.event.inputs.appleXcodeVersion }}
APPLE_MACOSX_SDK: ${{ github.event.inputs.appleMacosxSdk }}
APPLE_XCODE_APP_NAME: Xcode_13.3.1.app
APPLE_MACOSX_SDK: MacOSX12.3
run: rm -f /usr/local/lib/libjpeg* ; make apple

- name: Upload Apple Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: apple
path: ./release/apple/*.tar.gz
name: dotlottie-player.darwin.tar.gz
path: release/apple/dotlottie-player.darwin.tar.gz
if-no-files-found: error

- name: Build WASM
if: github.event.inputs.target == 'wasm' || github.event.inputs.target == 'all'
build-android:
runs-on: macos-latest
if: github.event.inputs.target == 'android' || github.event.inputs.target == 'all'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commitSHA || github.ref }}

- uses: Homebrew/actions/setup-homebrew@master
- uses: ningenMe/[email protected]

- name: Install Make
run: brew install make

- name: Build Setup
run: make mac-setup
env:
APPLE_XCODE_APP_NAME: ${{ github.event.inputs.appleXcodeVersion }}
APPLE_MACOSX_SDK: ${{ github.event.inputs.appleMacosxSdk }}
TARGET: android

- name: Build Android
run: make android

- name: Upload Android Artifacts
uses: actions/upload-artifact@v4
with:
name: dotlottie-player.android.tar.gz
path: release/android/dotlottie-player.android.tar.gz
if-no-files-found: error

build-wasm:
runs-on: macos-latest
if: github.event.inputs.target == 'wasm' || github.event.inputs.target == 'all'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.commitSHA || github.ref }}

- uses: Homebrew/actions/setup-homebrew@master
- uses: ningenMe/[email protected]

- name: Install Make
run: brew install make

- name: Build Setup
run: make mac-setup
env:
TARGET: wasm

- name: Build WASM
run: make wasm

- name: Upload WASM Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: wasm
path: ./release/wasm/*.tar.gz
name: dotlottie-player.wasm.tar.gz
path: release/wasm/dotlottie-player.wasm.tar.gz
if-no-files-found: error
4 changes: 4 additions & 0 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-pr:
if: github.head_ref != 'release'
Expand Down
80 changes: 66 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,101 @@
name: Release

on:
pull_request:
types: [closed]
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-artifacts:
if: github.head_ref == 'release' && github.event.pull_request.merged == true
build-apple:
runs-on: macos-12
if: github.head_ref == 'release' && github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- uses: Homebrew/actions/setup-homebrew@master
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "13.3.1"
- uses: ningenMe/[email protected]

- name: Install Make
run: brew install make

- name: Build Setup
run: make mac-setup
- name: Build Artifacts
env:
TARGET: apple

- name: Build Apple
env:
APPLE_XCODE_APP_NAME: Xcode_13.3.1.app
APPLE_MACOSX_SDK: MacOSX12.3
run: make all
- name: Upload Artifact
uses: actions/[email protected]
with:
name: dotlottie-player.android.tar.gz
path: release/android/dotlottie-player.android.tar.gz
if-no-files-found: error
- name: Upload Artifact
uses: actions/[email protected]
run: rm -f /usr/local/lib/libjpeg* ; make apple

- name: Upload Apple Artifacts
uses: actions/upload-artifact@v4
with:
name: dotlottie-player.darwin.tar.gz
path: release/apple/dotlottie-player.darwin.tar.gz
if-no-files-found: error
- name: Upload Artifact

build-android:
runs-on: macos-latest
if: github.head_ref == 'release' && github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- uses: Homebrew/actions/setup-homebrew@master
- uses: ningenMe/[email protected]

- name: Install Make
run: brew install make

- name: Build Setup
run: make mac-setup
env:
TARGET: android

- name: Build Android
run: make android

- name: Upload Android Artifacts
uses: actions/[email protected]
with:
name: dotlottie-player.android.tar.gz
path: release/android/dotlottie-player.android.tar.gz
if-no-files-found: error

build-wasm:
runs-on: macos-latest
if: github.head_ref == 'release' && github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- uses: Homebrew/actions/setup-homebrew@master
- uses: ningenMe/[email protected]

- name: Install Make
run: brew install make

- name: Build Setup
run: make mac-setup
env:
TARGET: wasm

- name: Build WASM
run: make wasm

- name: Upload WASM Artifacts
uses: actions/upload-artifact@v4
with:
name: dotlottie-player.wasm.tar.gz
path: release/wasm/dotlottie-player.wasm.tar.gz
if-no-files-found: error

release:
needs: [build-artifacts]
needs: [build-apple, build-android, build-wasm]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
101 changes: 67 additions & 34 deletions .mac-setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

TARGET=${TARGET:-all}

echo "Target: ${TARGET}"

SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"

# Formatting
Expand Down Expand Up @@ -42,57 +46,86 @@ check_for rustup "https://rustup.rs" "\
1. Choose the ${GREEN}default${NC} installation option
2. Either logout & login after the installation, or execute: ${YELLOW}source \"\$HOME/.cargo/env\""

echo "Installing v1.4.1 of Meson..."
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/2f89922685ce82af272fe045178f63bfb3bc7289/Formula/m/meson.rb > meson.rb
echo "Installing v1.6.0 of Meson..."
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/8ae7edfa2242b04dc01562dcb4536df60191593c/Formula/m/meson.rb > meson.rb
brew install meson.rb

echo "Installing brew package(s) ..."
brew install android-ndk \
cmake \
brew install cmake \
nasm \
ninja \
pkg-config \
conan \
ktlint \
swiftformat \
conan
swiftformat

if [[ "${TARGET}" == "android" || "${TARGET}" == "all" ]]; then
brew install android-ndk
fi

rustup component add rust-src

echo
echo "Installing rust target(s) ..."
rustup target add aarch64-linux-android \
armv7-linux-androideabi \
x86_64-linux-android \
i686-linux-android \
aarch64-apple-darwin \
x86_64-apple-darwin \
aarch64-apple-ios \
x86_64-apple-ios \
aarch64-apple-ios-sim \
wasm32-unknown-emscripten

echo "Installing nightly toolchain"
rustup install nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-emscripten --toolchain nightly

echo
echo "Installing cargo dependencies"
cargo install uniffi-bindgen-cpp \
--git https://github.com/NordSecurity/uniffi-bindgen-cpp \
--tag "${UNIFFI_BINDGEN_CPP_VERSION}"
case "${TARGET}" in
android)
rustup target add aarch64-linux-android \
armv7-linux-androideabi \
x86_64-linux-android \
i686-linux-android
;;
apple)
rustup target add aarch64-apple-darwin \
x86_64-apple-darwin \
aarch64-apple-ios \
x86_64-apple-ios \
aarch64-apple-ios-sim
;;
wasm)
rustup target add wasm32-unknown-emscripten
;;
all)
rustup target add aarch64-linux-android \
armv7-linux-androideabi \
x86_64-linux-android \
i686-linux-android \
aarch64-apple-darwin \
x86_64-apple-darwin \
aarch64-apple-ios \
x86_64-apple-ios \
aarch64-apple-ios-sim \
wasm32-unknown-emscripten
;;
*)
echo "${RED}Invalid target specified: ${TARGET}${NC}"
exit 1
;;
esac

echo
echo "Setting up project ..."
make deps

echo
echo "Setting up emsdk"
cd "${SCRIPT_DIR}/deps/modules/emsdk" || die "Could not find Emscripten SDK under ${RED}deps/modules/emsdk${NC}!"
./emsdk install "${EMSDK_VERSION}"
./emsdk activate "${EMSDK_VERSION}"
cd "${SCRIPT_DIR}/deps/modules/emsdk/upstream/emscripten" || die "Could not find Emscripten under ${RED}deps/modules/emsdk/upstream/emscripten${NC}!"
npm install
if [[ "${TARGET}" == "wasm" || "${TARGET}" == "all" ]]; then
echo "Installing nightly toolchain"
rustup install nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-emscripten --toolchain nightly

echo
echo "Installing cargo dependencies"
cargo install uniffi-bindgen-cpp \
--git https://github.com/NordSecurity/uniffi-bindgen-cpp \
--tag "${UNIFFI_BINDGEN_CPP_VERSION}"

echo
echo "Setting up emsdk"
cd "${SCRIPT_DIR}/deps/modules/emsdk" || die "Could not find Emscripten SDK under ${RED}deps/modules/emsdk${NC}!"
./emsdk install "${EMSDK_VERSION}"
./emsdk activate "${EMSDK_VERSION}"
cd "${SCRIPT_DIR}/deps/modules/emsdk/upstream/emscripten" || die "Could not find Emscripten under ${RED}deps/modules/emsdk/upstream/emscripten${NC}!"
npm install
fi

echo
echo "Disabling unneeded webp features"
Expand Down

0 comments on commit 13c9ebc

Please sign in to comment.