This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/skywalking-graalvm-distro.git
commit b9511ece60cfd6b8b14e82b29c8d4349c0f8fb0a Author: Wu Sheng <[email protected]> AuthorDate: Fri Mar 13 11:41:53 2026 +0800 Unify CI and release into single workflow with macOS builds - Merge release.yml into ci.yml: tag push or manual dispatch with version triggers release (GitHub Release page + version Docker tag) - Add macOS native builds (amd64 via macos-13, arm64 via macos-14) - Docker manifest tags: commit-sha always; version + latest for releases - CI-only builds (push to main): compile, test, e2e, commit-sha Docker tag - Release builds (tag or manual): skip e2e, build all platforms, publish --- .github/workflows/ci.yml | 174 ++++++++++++++++++++++- .github/workflows/release.yml | 317 ------------------------------------------ 2 files changed, 167 insertions(+), 324 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aa0103..7c08e5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,9 +18,20 @@ name: CI on: push: branches: [ main ] + tags: + - 'v*' pull_request: branches: [ main ] workflow_dispatch: + inputs: + commit: + description: 'Commit SHA to build (leave empty for latest on current branch)' + required: false + default: '' + version: + description: 'Version label for release artifacts (e.g. 1.0.0-rc1). Leave empty for CI-only build.' + required: false + default: '' concurrency: group: ci-${{ github.ref }} @@ -33,6 +44,7 @@ jobs: license-header: name: License Header Check runs-on: ubuntu-latest + if: github.event_name != 'workflow_dispatch' || github.event.inputs.version == '' steps: - name: Checkout uses: actions/checkout@v5 @@ -46,12 +58,32 @@ jobs: runs-on: ubuntu-latest outputs: cache-key: ${{ steps.cache-key.outputs.key }} + commit-sha: ${{ steps.meta.outputs.commit-sha }} + version: ${{ steps.meta.outputs.version }} + is-release: ${{ steps.meta.outputs.is-release }} steps: - name: Checkout with submodules uses: actions/checkout@v5 with: + ref: ${{ github.event.inputs.commit || github.ref }} submodules: recursive + - name: Resolve build metadata + id: meta + run: | + echo "commit-sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + # Determine if this is a release build + if [[ "${{ github.ref_type }}" == "tag" ]]; then + echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + echo "is-release=true" >> "$GITHUB_OUTPUT" + elif [[ -n "${{ github.event.inputs.version }}" ]]; then + echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" + echo "is-release=true" >> "$GITHUB_OUTPUT" + else + echo "version=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + echo "is-release=false" >> "$GITHUB_OUTPUT" + fi + - name: Set up GraalVM JDK 25 uses: graalvm/setup-graalvm@v1 with: @@ -78,6 +110,7 @@ jobs: name: Build & Test runs-on: ubuntu-latest needs: init-skywalking + if: needs.init-skywalking.outputs.is-release == 'false' steps: - name: Checkout with submodules uses: actions/checkout@v5 @@ -108,9 +141,9 @@ jobs: - name: Build distribution run: make build-distro - # ── Native image build per architecture ── - build-native: - name: Native ${{ matrix.arch }} + # ── Native image build for Linux (per architecture) ── + build-native-linux: + name: Native Linux ${{ matrix.arch }} runs-on: ${{ matrix.runner }} needs: init-skywalking if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' @@ -130,6 +163,7 @@ jobs: - name: Checkout with submodules uses: actions/checkout@v5 with: + ref: ${{ github.event.inputs.commit || github.ref }} submodules: recursive - name: Set up GraalVM JDK 25 @@ -178,6 +212,15 @@ jobs: digest="${{ steps.build.outputs.digest }}" touch "/tmp/digests/${digest#sha256:}" + - name: Rename tarball with arch and version + id: rename + run: | + VERSION="${{ needs.init-skywalking.outputs.version }}" + SRC=$(ls oap-graalvm-native/target/oap-graalvm-native-*-native-dist.tar.gz) + DEST="oap-graalvm-native/target/apache-skywalking-graalvm-distro-${VERSION}-linux-${{ matrix.arch }}.tar.gz" + cp "${SRC}" "${DEST}" + echo "path=${DEST}" >> "$GITHUB_OUTPUT" + - name: Upload digest uses: actions/upload-artifact@v5 with: @@ -186,6 +229,14 @@ jobs: if-no-files-found: error retention-days: 1 + - name: Upload native tarball + uses: actions/upload-artifact@v5 + with: + name: native-tarball-linux-${{ matrix.arch }} + path: ${{ steps.rename.outputs.path }} + if-no-files-found: error + retention-days: 1 + - name: Save Docker image for e2e (amd64 only) if: matrix.arch == 'amd64' run: | @@ -202,11 +253,64 @@ jobs: path: /tmp/skywalking-oap-native.tar retention-days: 1 + # ── Native image build for macOS (per architecture) ── + build-native-macos: + name: Native macOS ${{ matrix.arch }} + runs-on: ${{ matrix.runner }} + needs: init-skywalking + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + strategy: + matrix: + include: + - arch: amd64 + runner: macos-13 + - arch: arm64 + runner: macos-14 + steps: + - name: Checkout with submodules + uses: actions/checkout@v5 + with: + ref: ${{ github.event.inputs.commit || github.ref }} + submodules: recursive + + - name: Set up GraalVM JDK 25 + uses: graalvm/setup-graalvm@v1 + with: + java-version: '25' + distribution: 'graalvm' + + - name: Restore Maven cache + uses: actions/cache/restore@v5 + with: + path: ~/.m2/repository + key: ${{ needs.init-skywalking.outputs.cache-key }} + + - name: Build native image + run: make native-image + + - name: Rename tarball with arch and version + id: rename + run: | + VERSION="${{ needs.init-skywalking.outputs.version }}" + SRC=$(ls oap-graalvm-native/target/oap-graalvm-native-*-native-dist.tar.gz) + DEST="oap-graalvm-native/target/apache-skywalking-graalvm-distro-${VERSION}-macos-${{ matrix.arch }}.tar.gz" + cp "${SRC}" "${DEST}" + echo "path=${DEST}" >> "$GITHUB_OUTPUT" + + - name: Upload native tarball + uses: actions/upload-artifact@v5 + with: + name: native-tarball-macos-${{ matrix.arch }} + path: ${{ steps.rename.outputs.path }} + if-no-files-found: error + retention-days: 1 + # ── E2E tests using pre-built native image ── e2e: name: E2E ${{ matrix.test.name }} runs-on: ubuntu-latest - needs: [init-skywalking, build-native] + needs: [init-skywalking, build-native-linux] + if: needs.init-skywalking.outputs.is-release == 'false' timeout-minutes: 30 env: SW_AGENT_JDK_VERSION: 17 @@ -293,7 +397,7 @@ jobs: docker-manifest: name: Docker Manifest runs-on: ubuntu-latest - needs: build-native + needs: [init-skywalking, build-native-linux] permissions: contents: read packages: write @@ -318,7 +422,63 @@ jobs: - name: Create and push manifest working-directory: /tmp/digests run: | + VERSION="${{ needs.init-skywalking.outputs.version }}" + COMMIT_SHA="${{ needs.init-skywalking.outputs.commit-sha }}" + IS_RELEASE="${{ needs.init-skywalking.outputs.is-release }}" + TAGS="-t ${{ env.IMAGE }}:${COMMIT_SHA}" + if [[ "${IS_RELEASE}" == "true" ]]; then + TAGS="${TAGS} -t ${{ env.IMAGE }}:${VERSION} -t ${{ env.IMAGE }}:latest" + fi docker buildx imagetools create \ - -t ${{ env.IMAGE }}:latest \ - -t ${{ env.IMAGE }}:${GITHUB_SHA} \ + ${TAGS} \ $(printf '${{ env.IMAGE }}@sha256:%s ' *) + + # ── Upload tarballs to GitHub Release (release builds only) ── + github-release: + name: GitHub Release + runs-on: ubuntu-latest + needs: [init-skywalking, build-native-linux, build-native-macos] + if: needs.init-skywalking.outputs.is-release == 'true' + permissions: + contents: write + steps: + - name: Checkout with submodules + uses: actions/checkout@v5 + with: + ref: ${{ github.event.inputs.commit || github.ref }} + submodules: true + fetch-depth: 0 + + - name: Generate version metadata + run: | + VERSION="${{ needs.init-skywalking.outputs.version }}" + SW_COMMIT=$(git -C skywalking rev-parse HEAD) + SW_TAG=$(git -C skywalking describe --tags --exact-match "${SW_COMMIT}" 2>/dev/null || echo "none") + cat > /tmp/apache-skywalking-graalvm-distro-${VERSION}-version.txt <<EOF + Version: ${VERSION} + SkyWalking-Commit: ${SW_COMMIT} + SkyWalking-Tag: ${SW_TAG} + Build-Time: $(date -u +%Y-%m-%dT%H:%M:%SZ) + EOF + + - name: Download all native tarballs + uses: actions/download-artifact@v5 + with: + path: /tmp/tarballs + pattern: native-tarball-* + merge-multiple: true + + - name: Collect release files and generate checksums + run: | + cp /tmp/apache-skywalking-graalvm-distro-*-version.txt /tmp/tarballs/ + cd /tmp/tarballs + for f in *.tar.gz; do + sha512sum "${f}" > "${f}.sha512" + done + + - name: Upload to GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ needs.init-skywalking.outputs.version }} + files: /tmp/tarballs/* + generate_release_notes: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index c3c7b54..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,317 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Release - -on: - push: - tags: - - 'v*' - workflow_dispatch: - inputs: - commit: - description: 'Commit SHA to release (leave empty for latest on current branch)' - required: false - default: '' - version: - description: 'Version label for artifacts (e.g. 1.0.0-rc1). Required for manual trigger.' - required: true - -env: - IMAGE: ghcr.io/apache/skywalking-graalvm-distro - # Resolve ref: manual trigger uses input commit (or empty for branch HEAD) - RELEASE_REF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit || '' }} - -jobs: - # ── Shared: init skywalking submodule and cache .m2/repository ── - init-skywalking: - name: Init SkyWalking Submodule - runs-on: ubuntu-latest - outputs: - cache-key: ${{ steps.cache-key.outputs.key }} - version: ${{ steps.version.outputs.version }} - commit-sha: ${{ steps.commit-sha.outputs.sha }} - steps: - - name: Checkout with submodules - uses: actions/checkout@v5 - with: - ref: ${{ env.RELEASE_REF || github.ref }} - submodules: recursive - - - name: Resolve version - id: version - run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" - else - echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - fi - - - name: Resolve commit SHA - id: commit-sha - run: echo "sha=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - - - name: Set up GraalVM JDK 25 - uses: graalvm/setup-graalvm@v1 - with: - java-version: '25' - distribution: 'graalvm' - - - name: Compute cache key - id: cache-key - run: echo "key=m2-skywalking-$(git -C skywalking rev-parse HEAD)" >> "$GITHUB_OUTPUT" - - - name: Restore Maven cache - id: cache - uses: actions/cache@v5 - with: - path: ~/.m2/repository - key: ${{ steps.cache-key.outputs.key }} - - - name: Install SkyWalking submodule to Maven cache - if: steps.cache.outputs.cache-hit != 'true' - run: make init-skywalking - - # ── Native image build for Linux (per architecture) ── - build-native-linux: - name: Native Linux ${{ matrix.arch }} - runs-on: ${{ matrix.runner }} - needs: init-skywalking - strategy: - matrix: - include: - - arch: amd64 - runner: ubuntu-latest - platform: linux/amd64 - - arch: arm64 - runner: ubuntu-24.04-arm - platform: linux/arm64 - permissions: - contents: read - packages: write - steps: - - name: Checkout with submodules - uses: actions/checkout@v5 - with: - ref: ${{ env.RELEASE_REF || github.ref }} - submodules: recursive - - - name: Set up GraalVM JDK 25 - uses: graalvm/setup-graalvm@v1 - with: - java-version: '25' - distribution: 'graalvm' - - - name: Restore Maven cache - uses: actions/cache/restore@v5 - with: - path: ~/.m2/repository - key: ${{ needs.init-skywalking.outputs.cache-key }} - - - name: Build native image - run: make native-image - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Locate distro tarball - id: dist - run: echo "path=$(ls oap-graalvm-native/target/oap-graalvm-native-*-native-dist.tar.gz)" >> "$GITHUB_OUTPUT" - - - name: Build and push by digest - id: build - uses: docker/build-push-action@v6 - with: - context: . - file: docker/Dockerfile.native - platforms: ${{ matrix.platform }} - build-args: | - DIST=${{ steps.dist.outputs.path }} - outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true - - - name: Export digest - run: | - mkdir -p /tmp/digests - digest="${{ steps.build.outputs.digest }}" - touch "/tmp/digests/${digest#sha256:}" - - - name: Rename tarball with arch and version - id: rename - run: | - VERSION="${{ needs.init-skywalking.outputs.version }}" - SRC=$(ls oap-graalvm-native/target/oap-graalvm-native-*-native-dist.tar.gz) - DEST="oap-graalvm-native/target/apache-skywalking-graalvm-distro-${VERSION}-linux-${{ matrix.arch }}.tar.gz" - cp "${SRC}" "${DEST}" - echo "path=${DEST}" >> "$GITHUB_OUTPUT" - - - name: Upload digest - uses: actions/upload-artifact@v5 - with: - name: digests-${{ matrix.arch }} - path: /tmp/digests/* - if-no-files-found: error - retention-days: 1 - - - name: Upload native tarball - uses: actions/upload-artifact@v5 - with: - name: native-tarball-linux-${{ matrix.arch }} - path: ${{ steps.rename.outputs.path }} - if-no-files-found: error - retention-days: 1 - - # ── Native image build for macOS (per architecture) ── - build-native-macos: - name: Native macOS ${{ matrix.arch }} - runs-on: ${{ matrix.runner }} - needs: init-skywalking - strategy: - matrix: - include: - - arch: amd64 - runner: macos-13 - - arch: arm64 - runner: macos-14 - steps: - - name: Checkout with submodules - uses: actions/checkout@v5 - with: - ref: ${{ env.RELEASE_REF || github.ref }} - submodules: recursive - - - name: Set up GraalVM JDK 25 - uses: graalvm/setup-graalvm@v1 - with: - java-version: '25' - distribution: 'graalvm' - - - name: Restore Maven cache - uses: actions/cache/restore@v5 - with: - path: ~/.m2/repository - key: ${{ needs.init-skywalking.outputs.cache-key }} - - - name: Build native image - run: make native-image - - - name: Rename tarball with arch and version - id: rename - run: | - VERSION="${{ needs.init-skywalking.outputs.version }}" - SRC=$(ls oap-graalvm-native/target/oap-graalvm-native-*-native-dist.tar.gz) - DEST="oap-graalvm-native/target/apache-skywalking-graalvm-distro-${VERSION}-macos-${{ matrix.arch }}.tar.gz" - cp "${SRC}" "${DEST}" - echo "path=${DEST}" >> "$GITHUB_OUTPUT" - - - name: Upload native tarball - uses: actions/upload-artifact@v5 - with: - name: native-tarball-macos-${{ matrix.arch }} - path: ${{ steps.rename.outputs.path }} - if-no-files-found: error - retention-days: 1 - - # ── Merge per-arch images into multi-arch manifest with version + commit tags ── - docker-manifest: - name: Docker Manifest - runs-on: ubuntu-latest - needs: [init-skywalking, build-native-linux] - permissions: - contents: read - packages: write - steps: - - name: Download digests - uses: actions/download-artifact@v5 - with: - path: /tmp/digests - pattern: digests-* - merge-multiple: true - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Create and push manifest - working-directory: /tmp/digests - run: | - VERSION="${{ needs.init-skywalking.outputs.version }}" - COMMIT_SHA="${{ needs.init-skywalking.outputs.commit-sha }}" - docker buildx imagetools create \ - -t ${{ env.IMAGE }}:${VERSION} \ - -t ${{ env.IMAGE }}:${COMMIT_SHA} \ - -t ${{ env.IMAGE }}:latest \ - $(printf '${{ env.IMAGE }}@sha256:%s ' *) - - # ── Upload tarballs to GitHub Release ── - github-release: - name: GitHub Release - runs-on: ubuntu-latest - needs: [init-skywalking, build-native-linux, build-native-macos] - permissions: - contents: write - steps: - - name: Checkout with submodules - uses: actions/checkout@v5 - with: - ref: ${{ env.RELEASE_REF || github.ref }} - submodules: true - fetch-depth: 0 - - - name: Generate version metadata - run: | - VERSION="${{ needs.init-skywalking.outputs.version }}" - SW_COMMIT=$(git -C skywalking rev-parse HEAD) - SW_TAG=$(git -C skywalking describe --tags --exact-match "${SW_COMMIT}" 2>/dev/null || echo "none") - cat > /tmp/apache-skywalking-graalvm-distro-${VERSION}-version.txt <<EOF - Version: ${VERSION} - SkyWalking-Commit: ${SW_COMMIT} - SkyWalking-Tag: ${SW_TAG} - Build-Time: $(date -u +%Y-%m-%dT%H:%M:%SZ) - EOF - - - name: Download all native tarballs - uses: actions/download-artifact@v5 - with: - path: /tmp/tarballs - pattern: native-tarball-* - merge-multiple: true - - - name: Collect release files and generate checksums - run: | - cp /tmp/apache-skywalking-graalvm-distro-*-version.txt /tmp/tarballs/ - cd /tmp/tarballs - for f in *.tar.gz; do - sha512sum "${f}" > "${f}.sha512" - done - - - name: Upload to GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ needs.init-skywalking.outputs.version }} - files: /tmp/tarballs/* - generate_release_notes: true
