125 lines
4.0 KiB
YAML
125 lines
4.0 KiB
YAML
name: Main
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
workflow_run:
|
|
types:
|
|
- completed
|
|
workflows:
|
|
- "Update WIT"
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
main:
|
|
name: Build, test, and release
|
|
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set temporary build paths
|
|
run: |
|
|
echo "PUMPKIN_CI_REPOSITORY=$RUNNER_TEMP/pumpkin-maven" >> "$GITHUB_ENV"
|
|
|
|
- name: Read pinned tool versions
|
|
id: tools
|
|
run: |
|
|
while IFS='=' read -r name version; do
|
|
echo "$name=$version" >> "$GITHUB_OUTPUT"
|
|
done < gradle/tool-versions.properties
|
|
|
|
- name: Set up Java/Kotlin
|
|
uses: actions/setup-java@v6
|
|
with:
|
|
distribution: temurin
|
|
java-version: "25"
|
|
|
|
- name: Set up Gradle
|
|
uses: gradle/actions/setup-gradle@v6
|
|
with:
|
|
# PRs reuse the default-branch cache without updating it.
|
|
cache-read-only: ${{ github.ref != format('refs/heads/{0}', github.event.repository.default_branch) }}
|
|
|
|
- name: Cache binding generator
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: api/tools/wit-bindgen/${{ steps.tools.outputs.witBindgenRevision }}
|
|
key: ${{ runner.os }}-${{ runner.arch }}-wit-bindgen-${{ steps.tools.outputs.witBindgenRevision }}
|
|
|
|
- name: Cache consumer tools
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: example/build/tools/wasm-tools/${{ steps.tools.outputs.wasmToolsVersion }}
|
|
key: ${{ runner.os }}-${{ runner.arch }}-wasm-tools-${{ steps.tools.outputs.wasmToolsVersion }}
|
|
|
|
- name: Clear old cached build artifacts
|
|
run: |
|
|
set -eux
|
|
|
|
rm -f api/build/libs/*
|
|
rm -f gradle-plugin/build/libs/*
|
|
|
|
- name: Build and publish development packages
|
|
run: |
|
|
./gradlew :api:build :gradle-plugin:build :api:publishToMavenLocal :gradle-plugin:publishToMavenLocal \
|
|
-Dmaven.repo.local="$PUMPKIN_CI_REPOSITORY" --build-cache --no-daemon
|
|
|
|
- name: Build and validate example component
|
|
run: ./example/gradlew -p example build --build-cache --no-daemon
|
|
|
|
- name: Set GITHUB_RELEASE_TAG & ARTIFACT_ID
|
|
run: |
|
|
set -eux
|
|
if [[ '${{ github.ref }}' = refs/tags/v* ]]; then
|
|
tag='${{ github.ref }}'
|
|
tag="${tag:10}"
|
|
artifactID="${tag:1}"
|
|
else
|
|
tag=CI
|
|
artifactID='${{ github.sha }}'
|
|
artifactID="${artifactID:0:7}"
|
|
fi
|
|
echo "GITHUB_RELEASE_TAG=$tag" >> $GITHUB_ENV
|
|
echo "ARTIFACT_ID=$artifactID" >> $GITHUB_ENV
|
|
|
|
- name: Copy & rename artifacts
|
|
run: |
|
|
set -eux
|
|
|
|
mkdir artifacts
|
|
|
|
cp api/build/libs/pumpkin-api-kt-wasm-wasi-*.klib artifacts/pumpkin-api-kt-wasm-wasi-${ARTIFACT_ID}.klib
|
|
cp api/build/libs/pumpkin-api-kt-wasm-wasi-*-sources.jar artifacts/pumpkin-api-kt-wasm-wasi-${ARTIFACT_ID}-sources.jar
|
|
cp gradle-plugin/build/libs/pumpkin-api-kt-gradle-plugin-*.jar artifacts/pumpkin-api-kt-grade-plugin-${ARTIFACT_ID}.jar
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: kotlin-dist
|
|
path: artifacts/*
|
|
|
|
- name: Upload artifacts to release
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master'
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ env.GITHUB_RELEASE_TAG }}
|
|
artifacts: artifacts/*
|
|
allowUpdates: true
|
|
omitPrereleaseDuringUpdate: true
|
|
omitName: true
|
|
omitBody: true
|
|
omitDraftDuringUpdate: true
|
|
removeArtifacts: true
|