Skip to content

Commit

Permalink
Use computed build revision
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan971 committed Jan 9, 2025
1 parent bb6a378 commit d67556b
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 14 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,37 @@ on:
workflow_dispatch: { }

jobs:
build-hotspot:
uses: "./.github/workflows/build-hotspot.yml"
secrets: "inherit" # for Docker image publication
build_variables:
name: "Set build variables"
runs-on: "ubuntu-latest"
outputs:
build_image: "${{ steps.build_variables.outputs.build_image }}"
build_version: "${{ steps.build_variables.outputs.build_version }}"
steps:
- id: "build_variables"
run: |
set -euo pipefail
BUILD_IMAGE="$(echo "ghcr.io/$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')"
BUILD_VERSION="git-$(date +'%Y%m%d%H%M')-$(git rev-parse --short HEAD)"
echo "build_image=$BUILD_IMAGE" | tee -a "$GITHUB_OUTPUT"
echo "build_version=$BUILD_VERSION" | tee -a "$GITHUB_OUTPUT"
hotspot:
name: "HotSpot JIT"
needs: "build_variables"
uses: "./.github/workflows/hotspot.yml"
secrets: "inherit"
with:
JDK_VERSION: "23"
BUILD_IMAGE: "${{ needs.build_variables.build_image }}"
BUILD_REVISION: "${{ needs.build_variables.build_version }}"

graal:
name: "GraalVM AOT"
needs: [ "build_variables", "hotspot" ]
uses: "./.github/workflows/graal.yml"
secrets: "inherit"
with:
JDK_VERSION: "23"
BUILD_IMAGE: "${{ needs.build_variables.build_image }}"
BUILD_REVISION: "${{ needs.build_variables.build_version }}"
39 changes: 39 additions & 0 deletions .github/workflows/graal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
workflow_call:
inputs:
JDK_VERSION:
type: string
description: "JDK version to use for build"
required: true
BUILD_IMAGE:
type: string
description: "Build image"
required: true
BUILD_REVISION:
type: string
description: "Build revision"
required: true

jobs:
build:
runs-on: "ubuntu-latest"
container: "ghcr.io/mangadex-pub/jdk-maven:${{ inputs.JDK_VERSION }}-graal"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v4"
- name: "Cache local Maven repository"
uses: "actions/cache@v4"
with:
path: "~/.m2/repository"
key: "${{ runner.os }}-graal-${{ inputs.JDK_VERSION }}-${{ hashFiles('pom.xml') }}"
restore-keys: |
${{ runner.os }}-graal-${{ inputs.JDK_VERSION }}-
- name: "Build and test"
run: |
set -euo pipefail
mvn -Pnative -B -e -fae --show-version -Drevision="${{ inputs.BUILD_REVISION }}" -DskipTests package
- name: "Archive executable"
uses: "actions/upload-artifact@v4"
with:
name: "mcw-glibc"
path: "target/mcw"
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
on:
workflow_call:
inputs:
JDK_VENDOR:
type: string
description: "JDK vendor to use for build"
required: false
default: "corretto"
JDK_VERSION:
type: string
description: "JDK version to use for build"
required: true
BUILD_IMAGE:
type: string
description: "Build image"
required: true
BUILD_REVISION:
type: string
description: "Build revision"
required: true

jobs:
build-test:
build:
runs-on: "ubuntu-latest"
steps:
- name: "Checkout repository"
uses: "actions/checkout@v4"
- name: "Set up JDK"
uses: "actions/setup-java@v4"
with:
distribution: "${{ inputs.JDK_VENDOR }}"
distribution: "corretto"
java-version: "${{ inputs.JDK_VERSION }}"
- name: "Cache local Maven repository"
uses: "actions/cache@v4"
with:
path: "~/.m2/repository"
key: "${{ runner.os }}-hotspot-maven-${{ inputs.JDK_VERSION }}-${{ hashFiles('pom.xml') }}"
key: "${{ runner.os }}-hotspot-${{ inputs.JDK_VERSION }}-${{ hashFiles('pom.xml') }}"
restore-keys: |
${{ runner.os }}-hotspot-maven-${{ inputs.JDK_VERSION }}-
${{ runner.os }}-hotspot-${{ inputs.JDK_VERSION }}-
- name: "Build and test"
run: |
set -euo pipefail
export VERSION="git-$(date +'%Y%m%d%H%M')-$(git rev-parse --short HEAD)"
mvn -B -e -fae --show-version -T$(nproc)C -Drevision="$VERSION" -DsurefireTmpDir="$(pwd)/.github/tmpdir" verify package
mvn -B -e -fae --show-version -Drevision="${{ inputs.BUILD_REVISION }}" -DsurefireTmpDir="$(pwd)/.github/tmpdir" verify package
awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' target/site/jacoco/jacoco.csv
- name: "Archive jarfile"
uses: "actions/upload-artifact@v4"
Expand Down

0 comments on commit d67556b

Please sign in to comment.