Skip to content

add github action

add github action #3

# https://github.com/Kotlin/multiplatform-library-template/blob/main/.github/workflows/gradle.yml
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Run kmp-xlog demo.
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- cmd: "${GITHUB_WORKSPACE}/gradlew :kmp-xlog:testDebugUnitTest"
os: macos-latest
- cmd: "${GITHUB_WORKSPACE}/gradlew :example:androidApp:assembleDebug"
os: macos-latest
- cmd: "${GITHUB_WORKSPACE}/scripts/build_apple.sh && ${GITHUB_WORKSPACE}/gradlew runKmp_xlogDebugExecutableMacosX64"
os: macos-latest
dep: "brew update && brew install xcodegen"
- cmd: "${GITHUB_WORKSPACE}/scripts/build_xlog_linux.sh && ${GITHUB_WORKSPACE}/gradlew runKmp_xlogDebugExecutableLinuxX64"
os: ubuntu-latest
dep: "sudo apt-get update && sudo apt-get install zlib1g-dev"
- cmd: "${GITHUB_WORKSPACE}/gradlew runKmp_xlogDebugExecutableMingwX64"
os: windows-latest
- cmd: "${GITHUB_WORKSPACE}/gradlew :example:shared:jsBrowserDistribution"
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/cache@v4
with:
path: |
~/.konan
key: ${{ runner.os }}-${{ hashFiles('**/.lock') }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- if: ${{ matrix.dep }}
run: ${{ matrix.dep }}
- run: ${{ matrix.cmd }}