Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton committed Dec 18, 2024
1 parent ce5633b commit d48a2c2
Show file tree
Hide file tree
Showing 13 changed files with 2,605 additions and 257 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/build-linux-amd64.sh

This file was deleted.

94 changes: 0 additions & 94 deletions .github/workflows/build-mac.sh

This file was deleted.

106 changes: 53 additions & 53 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,84 +13,79 @@ env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:
build:
zig:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0

- run: zig build -p src/jvmMain/resources/jni
working-directory: zipline

- uses: actions/upload-artifact@v4
with:
name: jni-binaries
path: zipline/src/jvmMain/resources/jni
if-no-files-found: error

tests:
needs:
- zig
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [amd64]
cmake-arch: [x86_64]
include:
- os: macos-latest-large
arch: x86_64
cmake-arch: x86_64
platform:
- os: macos-13
task: macosX64Test
- os: macos-latest
arch: aarch64
cmake-arch: arm64
# TODO: build on 'windows-latest'
task: macosArm64Test
- os: ubuntu-latest
task: linuxX64Test

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.platform.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 20
java-version: 23

- name: Build native library (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install -y libtinfo6
cp -a . ../zipline-dockerbuild
docker build \
--tag zipline-linux-amd64 \
.github/workflows
docker run \
--volume `pwd`/../zipline-dockerbuild:/zipline \
--workdir /zipline \
--entrypoint ./.github/workflows/build-linux-amd64.sh \
zipline-linux-amd64
mkdir -p zipline/src/jvmMain/resources/jni/amd64
cp -v ../zipline-dockerbuild/build/jni/amd64/libquickjs.* zipline/src/jvmMain/resources/jni/amd64/
- name: Build native library (macOS)
if: matrix.os == 'macos-latest' || matrix.os == 'macos-latest-large'
run: ./.github/workflows/build-mac.sh -a ${{ matrix.arch }} -c ${{ matrix.cmake-arch }}
- uses: actions/download-artifact@v4
with:
name: jni-binaries
path: zipline/src/jvmMain/resources/jni

- name: Zipline tests
run: ./gradlew :zipline:check --stacktrace
run: ./gradlew :zipline:jvmTest :zipline:${{ matrix.platform.task }} --stacktrace

- name: Build all Zipline
if: matrix.os == 'macos-latest'
if: matrix.platform.os == 'macos-latest'
run: ./gradlew build --stacktrace

- name: Build samples
if: matrix.os == 'macos-latest'
if: matrix.platform.os == 'macos-latest'
run: ./gradlew -p samples check --stacktrace

- uses: actions/upload-artifact@v4
with:
name: jvm-native-libraries-${{ matrix.os }}-${{ matrix.arch }}
path: zipline/src/jvmMain/resources/*
if-no-files-found: error

- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-report-${{ matrix.os }}-${{ matrix.arch }}
name: test-report-${{ matrix.platform.os }}
path: '**/build/reports/tests/**'
retention-days: 1

android:
android-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 20
java-version: 23

- name: Enable KVM
run: |
Expand All @@ -106,15 +101,15 @@ jobs:
emulator-boot-timeout: 20000
script: ./gradlew connectedCheck

ios:
ios-app:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 20
java-version: 23

- name: Build Xcode samples
run: |
Expand All @@ -125,22 +120,21 @@ jobs:
publish:
runs-on: macos-latest
needs:
- build
- android
- ios
- tests
- android-tests
- ios-app

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 20
java-version: 23

- uses: actions/download-artifact@v4
with:
pattern: jvm-native-libraries-*
path: zipline/src/jvmMain/resources
merge-multiple: true
name: jni-binaries
path: zipline/src/jvmMain/resources/jni

- run: ./gradlew assemble :dokkaHtmlMultiModule

Expand All @@ -162,6 +156,12 @@ jobs:
path: zipline-cli/build/distributions/zipline-cli-*.zip
if-no-files-found: error

- uses: actions/upload-artifact@v4
with:
name: html-docs
path: build/dokka/htmlMultiModule/
if-no-files-found: error

- run: ./gradlew publishToMavenCentral
if: ${{ github.ref == 'refs/heads/trunk' && github.repository == 'cashapp/zipline' }}
env:
Expand Down
62 changes: 6 additions & 56 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,8 @@ on:

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 60

jobs:
native-library:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [amd64]
cmake-arch: [x86_64]
include:
- os: macos-latest-large
arch: x86_64
cmake-arch: x86_64
- os: macos-latest
arch: aarch64
cmake-arch: arm64
# TODO: build on 'windows-latest'

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 20

- name: Build native library (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cp -a . ../zipline-dockerbuild
docker build \
--tag zipline-linux-amd64 \
.github/workflows
docker run \
--volume `pwd`/../zipline-dockerbuild:/zipline \
--workdir /zipline \
--entrypoint ./.github/workflows/build-linux-amd64.sh \
zipline-linux-amd64
mkdir -p zipline/src/jvmMain/resources/jni/amd64
cp -v ../zipline-dockerbuild/build/jni/amd64/libquickjs.* zipline/src/jvmMain/resources/jni/amd64/
- name: Build native library (macOS)
if: matrix.os == 'macos-latest' || matrix.os == 'macos-latest-large'
run: ./.github/workflows/build-mac.sh -a ${{ matrix.arch }} -c ${{ matrix.cmake-arch }}

- uses: actions/upload-artifact@v4
with:
name: jvm-native-libraries-${{ matrix.os }}-${{ matrix.arch }}
path: zipline/src/jvmMain/resources/*
if-no-files-found: error

publish:
runs-on: macos-latest
needs:
Expand All @@ -70,13 +19,14 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 20
java-version: 23

- uses: actions/download-artifact@v4
- uses: goto-bus-stop/setup-zig@v2
with:
pattern: jvm-native-libraries-*
path: zipline/src/jvmMain/resources
merge-multiple: true
version: 0.13.0

- run: zig build -p src/jvmMain/resources/jni
working-directory: zipline

- run: ./gradlew publishToMavenCentral :dokkaHtmlMultiModule
if: ${{ github.repository == 'cashapp/zipline' }}
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ samples/**/yarn.lock
zipline-gradle-plugin/src/test/projects/**/yarn.lock

generated-zipline-webpack-config.js

# Zig
.zig-cache
zig-out
Loading

0 comments on commit d48a2c2

Please sign in to comment.