Skip to content

Commit

Permalink
Merge pull request #170 from gudzpoz/luaj-coverage
Browse files Browse the repository at this point in the history
Update workflow actions and improve test coverage
  • Loading branch information
gudzpoz authored Apr 27, 2024
2 parents a7faf5e + c0ecf70 commit f6872e0
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 144 deletions.
167 changes: 68 additions & 99 deletions .github/workflows/build-natives.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,55 +21,50 @@ jobs:
apple-natives:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- run: echo "JAVA_8=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- run: echo "JAVA_11=$JAVA_HOME" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build natives
run: |
./gradlew jniGen jnigenBuild
- name: Test
run: |
./gradlew :example:test :jsr223:test :jpms-example:run
- name: Upload macOS/iOS natives
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: apple-natives
path: ./*/libs
retention-days: 5
most-natives:
environment: Codecov
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- run: echo "JAVA_8=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
Expand Down Expand Up @@ -97,15 +92,8 @@ jobs:
make check
`pwd`/src/patchelf --version
echo "`pwd`/src" >> $GITHUB_PATH
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build natives
run: |
export NDK_HOME=$ANDROID_NDK_LATEST_HOME
Expand All @@ -119,54 +107,51 @@ jobs:
export NDK_HOME=$ANDROID_NDK_LATEST_HOME
./gradlew jacocoTestReport
- name: Upload test result
uses: codecov/codecov-action@v3
with:
files: ./lua51/build/reports/jacoco/report.xml,./lua52/build/reports/jacoco/report.xml,./lua53/build/reports/jacoco/report.xml,./lua54/build/reports/jacoco/report.xml,./luajit/build/reports/jacoco/report.xml,./luajava/build/reports/jacoco/report.xml,./jsr223/build/reports/jacoco/report.xml
uses: codecov/codecov-action@v4
with:
files: >-
./lua51/build/reports/jacoco/report.xml,
./lua52/build/reports/jacoco/report.xml,
./lua53/build/reports/jacoco/report.xml,
./lua54/build/reports/jacoco/report.xml,
./luajit/build/reports/jacoco/report.xml,
./luaj/build/reports/jacoco/report.xml,
./luajava/build/reports/jacoco/report.xml,
./jsr223/build/reports/jacoco/report.xml
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload all output libs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: most-natives
path: ./*/libs
- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
retention-days: 5
linux-testing:
runs-on: ubuntu-latest
needs:
- most-natives
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- run: echo "JAVA_8=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- run: echo "JAVA_11=$JAVA_HOME" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Download most-natives artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: most-natives
- name: Gradle cache
uses: gradle/[email protected]
- name: JniGen
run: |
./gradlew jniGen
Expand All @@ -186,32 +171,25 @@ jobs:
needs:
- most-natives
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- run: echo "JAVA_8=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- run: echo "JAVA_11=$JAVA_HOME" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Download most-natives artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: most-natives
- name: JniGen
Expand All @@ -236,44 +214,35 @@ jobs:
needs:
- most-natives
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- run: echo "JAVA_8=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- run: echo "JAVA_11=$JAVA_HOME" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Download most-natives artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: most-natives
- name: Gradle cache
uses: gradle/[email protected]
- name: JniGen
run: |
./gradlew jniGen
- name: Pack Android natives
run: |
./gradlew :android:assemble
- name: AVD cache
uses: actions/cache@v3
uses: actions/cache@v4
id: avd-cache
with:
path: |
Expand Down Expand Up @@ -314,36 +283,29 @@ jobs:
- linux-testing
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- run: echo "JAVA_8=$JAVA_HOME" >> $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- run: echo "JAVA_11=$JAVA_HOME" >> $GITHUB_ENV
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Download apple-natives artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: apple-natives
- name: Download most-natives artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: most-natives
- name: JniGen
Expand All @@ -360,7 +322,7 @@ jobs:
run: |
./gradlew :android:assemble
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: natives
path: ./*/libs
Expand All @@ -384,7 +346,7 @@ jobs:
run: |
./gradlew :example:shadowJar
- name: Upload example
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: example
path: example/build/libs/example-all.jar
Expand All @@ -394,17 +356,24 @@ jobs:
with:
draft: true
files: example/build/libs/example-all.jar
arm-tests:
mac-arm-test:
needs:
- pack-natives
runs-on: macos-14
steps:
- name: Download example tests
uses: actions/download-artifact@v4
with:
name: example
- name: Run example tests
run: |
java -jar example-all.jar --test
linux-arm-test:
environment: Bitrise
needs:
- pack-natives
runs-on: ubuntu-20.04
steps:
- name: Trigger Bitrise tests for macOS on M1
env:
BITRISE_TOKEN: ${{ secrets.BITRISE_TOKEN }}
run: |
curl -X POST -H "Authorization: $BITRISE_TOKEN" -d '{"hook_info":{"type":"bitrise"},"build_params":{"branch":"main","workflow_id":"primary"}}' https://app.bitrise.io/app/ace86394e12a32ad/build/start.json
- name: Trigger CircleCI tests for Linux on arm64
env:
CIRCLECI_TOKEN: ${{ secrets.CIRCLECI_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![Build Status](https://github.com/gudzpoz/luajava/actions/workflows/docs.yml/badge.svg)](https://github.com/gudzpoz/luajava/actions/workflows/docs.yml)
[![Document Version](https://img.shields.io/github/package-json/v/gudzpoz/luajava?filename=docs%2Fpackage.json&label=Documentation)](https://gudzpoz.github.io/luajava/)

[![Tests: macOS on M1](https://img.shields.io/bitrise/ace86394e12a32ad/main?label=macOS%20on%20M1&token=t-lcEHLpUl_xT-CeJYzagg)](https://app.bitrise.io/app/ace86394e12a32ad)
[![Tests: macOS on M1](https://img.shields.io/github/actions/workflow/status/gudzpoz/luajava/build-natives.yml?label=macOS%20on%20M1)](https://github.com/gudzpoz/luajava/actions/workflows/build-natives.yml)
[![Tests: Linux on arm64](https://img.shields.io/circleci/build/github/gudzpoz/luajava/main?label=Linux%20on%20arm64)](https://app.circleci.com/pipelines/github/gudzpoz/luajava)

[![Hello World Example](./docs/.vuepress/public/hello.svg)](https://gudzpoz.github.io/luajava/examples/hello-world-mod.html)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ description: LuaJava, a scripting tool for Java
[![Build Status](https://github.com/gudzpoz/luajava/actions/workflows/docs.yml/badge.svg)](https://github.com/gudzpoz/luajava/actions/workflows/docs.yml)
[![Document Version](https://img.shields.io/github/package-json/v/gudzpoz/luajava?filename=docs%2Fpackage.json&label=Documentation)](https://gudzpoz.github.io/luajava/)

[![Tests: macOS on M1](https://img.shields.io/bitrise/ace86394e12a32ad/main?label=macOS%20on%20M1&token=t-lcEHLpUl_xT-CeJYzagg)](https://app.bitrise.io/app/ace86394e12a32ad)
[![Tests: macOS on M1](https://img.shields.io/github/actions/workflow/status/gudzpoz/luajava/build-natives.yml?label=macOS%20on%20M1)](https://github.com/gudzpoz/luajava/actions/workflows/build-natives.yml)
[![Tests: Linux on arm64](https://img.shields.io/circleci/build/github/gudzpoz/luajava/main?label=Linux%20on%20arm64)](https://app.circleci.com/pipelines/github/gudzpoz/luajava)

<style>
Expand Down
Loading

0 comments on commit f6872e0

Please sign in to comment.