Create a matrix job for apple (#195)

* Create a matrix job for apple

* Skip tests on x86_64

* Change dependencies back

* Remove dependencies from justfile task
This commit is contained in:
Max Ammann 2022-11-04 10:03:27 +01:00 committed by GitHub
parent 93318433ad
commit 0b17bc83d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 15 deletions

View File

@ -4,16 +4,39 @@ on:
workflow_call:
jobs:
library-apple:
name: Build
runs-on: macos-12
strategy:
matrix:
name:
- fat-aarch64-x86_64-apple-darwin
- aarch64-apple-ios
- aarch64-apple-ios-sim
include:
- name: fat-aarch64-x86_64-apple-darwin # (xcodebuild-archive "arm64" "macOS") (xcodebuild-archive-fat "arm64" "macOS" "x86_64")
target: aarch64-apple-darwin
arch: arm64
platform: macOS
fat-target: x86_64-apple-darwin
fat-arch: x86_64
- name: aarch64-apple-ios # xcodebuild-clean (xcodebuild-archive "arm64" "iOS")
target: aarch64-apple-ios
arch: arm64
platform: iOS
- name: aarch64-apple-ios-sim # (xcodebuild-archive "arm64" "iOS Simulator")
target: aarch64-apple-ios-sim
arch: arm64
platform: iOS Simulator
name: Build ${{ matrix.name }}
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
targets: x86_64-apple-darwin aarch64-apple-darwin x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
targets: ${{ matrix.target }} ${{ matrix.fat-target }}
- name: Swift Version
shell: bash
run: swift --version
@ -22,21 +45,71 @@ jobs:
run: xcodebuild -version
- name: Build
shell: bash
run: just xcodebuild-xcframework
- name: Check x86_64 darwin
run: just xcodebuild-archive ${{ matrix.arch }} "${{ matrix.platform }}"
- name: Build fat
if: ${{ matrix.fat-arch }}
shell: bash
run: just check apple x86_64-apple-darwin
- name: Check aarch64 darwin
run: just xcodebuild-archive-fat ${{ matrix.arch }} "${{ matrix.platform }}" ${{ matrix.fat-arch }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}
path: apple/build/*.xcarchive
- name: Check
shell: bash
# TODO: Additional clippy checks for different targets (iOS)
run: just check apple aarch64-apple-darwin
- name: Test x86_64 darwin
run: just check apple ${{ matrix.target }}
- name: Test
if: ${{ matrix.arch == 'x86_64' }} # TODO: We can only test on x86_64, this is current limitation
shell: bash
# TODO: Additional test runs for different targets (Different targets might require emulation)
run: just test apple x86_64-apple-darwin
- name: Build Example
run: just test apple ${{ matrix.target }}
- name: Check fat
if: ${{ matrix.fat-target }}
shell: bash
run: just check apple ${{ matrix.fat-target }}
- name: Test fat
if: ${{ matrix.fat-target && matrix.fat-arch == 'x86_64' }} # TODO: We can only test on x86_64, this is current limitation
shell: bash
run: just check apple ${{ matrix.fat-target }}
library-apple-test-xcode-project:
name: Test XCode project
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
targets: aarch64-apple-ios
- name: Build Example (iOS)
shell: bash
run: cd apple/xcode && xcodebuild -scheme "example (iOS)" -arch arm64 -sdk iphoneos build CODE_SIGNING_ALLOWED=NO
library-apple-bundle:
name: Bundle
runs-on: macos-12
needs:
- library-apple
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Download fat-aarch64-x86_64-apple-darwin
uses: actions/download-artifact@v3
with:
name: fat-aarch64-x86_64-apple-darwin
path: apple/build/
- name: Download aarch64-apple-ios
uses: actions/download-artifact@v3
with:
name: aarch64-apple-ios
path: apple/build/
- name: Download aarch64-apple-ios-sim
uses: actions/download-artifact@v3
with:
name: aarch64-apple-ios-sim
path: apple/build/
- name: Bundle
shell: bash
run: just xcodebuild-xcframework
- name: Build Swift Package (arm64)
shell: bash
run: cd apple/MapLibreRs && swift build -v --arch=arm64 --scratch-path .build-arm64

View File

@ -158,7 +158,7 @@ xcodebuild-clean:
rm -rf {{XC_FRAMEWORK_DIRECTORY}}/*.xcframework
# language=bash
xcodebuild-xcframework: xcodebuild-clean (xcodebuild-archive "arm64" "iOS") (xcodebuild-archive "arm64" "macOS") (xcodebuild-archive "arm64" "iOS Simulator") (xcodebuild-archive-fat "arm64" "macOS" "x86_64")
xcodebuild-xcframework:
#!/usr/bin/env bash
set -euxo pipefail
tuples=(

View File

@ -97,7 +97,7 @@ impl<ET: 'static + PartialEq + Debug> EventLoop<ET> for WinitEventLoop<ET> {
Handle::current().block_on(async {
map.initialize_renderer(RendererBuilder::new()
.with_wgpu_settings(WgpuSettings {
backends: Some(Backends::VULKAN),
backends: Some(Backends::VULKAN), // FIXME: Change
..WgpuSettings::default()
})).await.unwrap();
})

View File

@ -91,7 +91,7 @@ pub fn run_headed_map(cache_path: Option<String>) {
#[cfg(not(target_os = "android"))]
{
map.initialize_renderer(RendererBuilder::new().with_wgpu_settings(WgpuSettings {
backends: Some(Backends::VULKAN),
backends: Some(Backends::VULKAN), // FIXME: Change
..WgpuSettings::default()
}))
.await