blob: df175942ece87cf0d06a737a127229b4e4a9db8f [file] [log] [blame]
name: Build, Test (JDK 22)
on:
push:
branches:
- master
- v3
pull_request:
branches:
- master
- v3
jobs:
# This is a matrix build {'java', 'javascript'},
# where only the 'java' part triggers the Maven build,
# and only the 'javascript' part triggers the CodeQL autobuild.
# Those builds must run in between the "CodeQL: Initialize" and "CodeQL: Perform Analysis" steps!
# CodeQL can be disabled via SKIP_CODE_QL: true
build:
name: build-local-no-push
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
matrix:
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
language: [ 'java', 'javascript' ]
env:
# to be shared among all steps of this job
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BASELINE: 2.0.0
PROJECT_ROOT_PATH: ${{ github.workspace }}
CI_SCRIPTS_PATH: ${{ github.workspace }}/scripts/ci
# not used, would be nice if we could transform the TIMESTAMP string into the REVISION
# variable here, but it seems github not yet has any string expression manipulation
# operators other than concatination
TIMESTAMP: ${{ github.event.head_commit.timestamp }}
# set this to 'deploy' when intent is to push the built packages to a repo
# requires 'secrets' which we don't have yet
MVN_STAGES: install
# options
# CodeQL action seems broken on JDK22, waiting for updates
SKIP_CODE_QL: true
steps:
- uses: actions/checkout@v4
- name: Set up JDK 22
if: matrix.language == 'java'
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 22
- name: Print Maven Version
if: matrix.language == 'java'
run: mvn --version
- name: Activate Cache for Maven Downloads
if: matrix.language == 'java'
uses: actions/cache@v4
env:
# change the cache-name if we want to rebuild the cache
# can be reset via github action page
cache-name: maven-shared
with:
path: ~/.m2/repository
key: ${{ runner.os }}-${{ env.cache-name }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}
${{ runner.os }}-
- name: Setup Script Environment
if: matrix.language == 'java'
shell: bash
run: |
echo ============== ENV =================
echo BRANCH_NAME \: $BRANCH_NAME
echo BASELINE \: $BASELINE
echo TIMESTAMP \: $TIMESTAMP
echo PROJECT_ROOT_PATH\: $PROJECT_ROOT_PATH
echo CI_SCRIPTS_PATH \: $CI_SCRIPTS_PATH
echo MVN_STAGES \: $MVN_STAGES
echo ======================================
# CodeQL Analysis (https://codeql.github.com/docs/codeql-overview/about-codeql/)
- name: "CodeQL: Initialize"
if: env.SKIP_CODE_QL != 'true'
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Build Artifacts
if: matrix.language == 'java'
shell: bash
run: bash $CI_SCRIPTS_PATH/build-artifacts.sh
env:
# -Dmodule-all ... build all modules (default if all is well)
# -Dmodule-all-except-incubator ... build all modules except 'incubator'
# -Dmodule-all-except-kroviz ... build all modules except 'kroviz' (eg. when kroviz build fails)
# -Denforcer.failFast=true ... fail fast on convergence issues (enforcer plugin)
# -Dmaven.source.skip=true ... no need for the CI build to pull sources
# -Dproject.build.outputTimestamp=2023-01-01T00:00:00Z see https://maven.apache.org/guides/mini/guide-reproducible-builds.html
# -T 1C ... 1 build thread per core
MVN_ADDITIONAL_OPTS: >-
-Dmodule-all
-Denforcer.failFast=true
-Dmaven.source.skip=true
-Dproject.build.outputTimestamp=2023-01-01T00:00:00Z
-e
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually
- name: "CodeQL: Autobuild"
if: env.SKIP_CODE_QL != 'true' && matrix.language == 'javascript'
uses: github/codeql-action/autobuild@v3
- name: "CodeQL: Perform Analysis"
if: env.SKIP_CODE_QL != 'true'
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
# FOR DEBUG USE
# - name: Dump GitHub context
# env:
# ENV_CONTEXT: ${{ toJson(env) }}
# run: echo "$ENV_CONTEXT"
# - name: Dump GitHub context
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: echo "$GITHUB_CONTEXT"
# - name: Dump job context
# env:
# JOB_CONTEXT: ${{ toJson(job) }}
# run: echo "$JOB_CONTEXT"
# - name: Dump steps context
# env:
# STEPS_CONTEXT: ${{ toJson(steps) }}
# run: echo "$STEPS_CONTEXT"
# - name: Dump runner context
# env:
# RUNNER_CONTEXT: ${{ toJson(runner) }}
# run: echo "$RUNNER_CONTEXT"
# - name: Dump strategy context
# env:
# STRATEGY_CONTEXT: ${{ toJson(strategy) }}
# run: echo "$STRATEGY_CONTEXT"
# - name: Dump matrix context
# env:
# MATRIX_CONTEXT: ${{ toJson(matrix) }}
# run: echo "$MATRIX_CONTEXT"