feat: removed task cleanFrontend (#273) #303
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ 'main' ] | |
pull_request: | |
branches: [ 'main' ] | |
workflow_dispatch: | |
inputs: | |
pluginJavaVersion: | |
description: 'JDK compatibility version of the plugin' | |
required: true | |
default: '21' | |
type: choice | |
options: | |
- '21' | |
- '17' | |
- '11' | |
- 'All' | |
os: | |
description: 'O/S' | |
required: true | |
default: 'ubuntu-24.04' | |
type: choice | |
options: | |
- 'ubuntu-24.04' | |
- 'macos-14' | |
- 'windows-2022' | |
- 'All' | |
jobs: | |
define-matrix: | |
name: Define matrix | |
runs-on: ubuntu-24.04 | |
outputs: | |
os: ${{ steps.set-matrix-variables.outputs.os }} | |
pluginJavaVersion: ${{ steps.set-matrix-variables.outputs.pluginJavaVersion }} | |
steps: | |
- name: Set matrix variables | |
id: set-matrix-variables | |
run: | | |
if [[ (-z "${{ inputs.os }}") || ("${{ inputs.os }}" == "All") ]]; then | |
echo 'os=["ubuntu-24.04", "macos-14", "windows-2022"]' >> "$GITHUB_OUTPUT" | |
else | |
echo 'os=["${{ inputs.os }}"]' >> "$GITHUB_OUTPUT" | |
fi | |
if [[ ("${{ github.event_name }}" == "push") || "${{ inputs.pluginJavaVersion }}" == "All" ]]; then | |
echo 'pluginJavaVersion=["21", "17", "11"]' >> "$GITHUB_OUTPUT" | |
elif [[ -n "${{ inputs.pluginJavaVersion }}" ]]; then | |
echo 'pluginJavaVersion=["${{ inputs.pluginJavaVersion }}"]' >> "$GITHUB_OUTPUT" | |
else | |
echo 'pluginJavaVersion=["21"]' >> "$GITHUB_OUTPUT" | |
fi | |
build: | |
name: Build | |
needs: define-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ${{ fromJSON(needs.define-matrix.outputs.os) }} | |
pluginJavaVersion: ${{ fromJSON(needs.define-matrix.outputs.pluginJavaVersion) }} | |
steps: | |
- name: Init environment | |
if: (matrix.os == 'ubuntu-24.04') && (matrix.pluginJavaVersion == '21') | |
run: echo "FGP_CODE_SCAN_ENABLED=1" >> $GITHUB_ENV | |
- name: Init Ubuntu environment | |
if: matrix.os == 'ubuntu-24.04' | |
run: sudo rm -f /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/pnpm /usr/local/bin/yarn | |
- name: Init MacOS environment | |
if: matrix.os == 'macos-14' | |
run: sudo rm -f /opt/homebrew/bin/node /usr/local/bin/npm /usr/local/bin/pnpm /usr/bin/yarn /Users/runner/.yarn/bin/yarn | |
- name: Init Windows environment | |
if: matrix.os == 'windows-2022' | |
run: | | |
Rename-Item "C:\Program Files\nodejs" "nodejs.old" -Force | |
Rename-Item "C:\npm" "npm.old" -Force | |
Remove-Item Env:npm_config_prefix | |
- name: Git checkout for source code analysis | |
uses: actions/checkout@v4 | |
if: env.FGP_CODE_SCAN_ENABLED | |
with: | |
fetch-depth: 0 | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
if: ${{ ! env.FGP_CODE_SCAN_ENABLED }} | |
with: | |
fetch-depth: 1 | |
- name: Set up additional JDK | |
uses: actions/setup-java@v4 | |
if: matrix.pluginJavaVersion != '21' | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.pluginJavaVersion }} | |
architecture: x64 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '21' | |
architecture: x64 | |
- name: Cache Gradle's cache and wrapper | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches/ | |
~/.gradle/wrapper/ | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Cache Sonar's cache | |
uses: actions/cache@v4 | |
if: env.FGP_CODE_SCAN_ENABLED | |
with: | |
path: | | |
~/.sonar/cache/ | |
key: ${{ runner.os }}-sonar-${{ hashFiles('**/*.gradle*') }} | |
- name: Grant executable permission | |
run: chmod +x gradlew plugins/frontend-jdk*/src/integrationTest/resources/*/bin/* | |
- name: Build plugin on Linux/Mac OS | |
if: runner.os != 'Windows' | |
run: | | |
if [[ "${{ env.FGP_CODE_SCAN_ENABLED }}" ]]; then | |
gradleTaskName=:plugins:frontend-jdk${{ matrix.pluginJavaVersion }}:jacocoTestReport | |
else | |
gradleTaskName=:plugins:frontend-jdk${{ matrix.pluginJavaVersion }}:build | |
fi | |
./gradlew $gradleTaskName --console=plain | |
- name: Build plugin on Windows | |
if: runner.os == 'Windows' | |
run: | | |
./gradlew :plugins:frontend-jdk${{ matrix.pluginJavaVersion }}:build --console=plain | |
- name: Scan source code and test results | |
if: env.FGP_CODE_SCAN_ENABLED | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew :plugins:frontend-jdk${{ matrix.pluginJavaVersion }}:sonar --console=plain -Dorg.gradle.jvmargs=-Xmx512m -i | |
- name: Stop Gradle before caching | |
run: ./gradlew -stop |