feat: added option for custom environment variables in Node.js-based tasks #199
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', '*.*-jdk*' ] | |
pull_request: | |
branches: [ 'main', '*.*-jdk*' ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-14, windows-2022] | |
steps: | |
- name: Init Ubuntu environment | |
if: matrix.os == 'ubuntu-22.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 | |
- name: Git checkout for source code analysis | |
uses: actions/checkout@v4 | |
if: matrix.os == 'ubuntu-22.04' | |
with: | |
fetch-depth: 0 | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
if: matrix.os != 'ubuntu-22.04' | |
with: | |
fetch-depth: 1 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '17' | |
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: matrix.os == 'ubuntu-22.04' | |
with: | |
path: | | |
~/.sonar/cache/ | |
key: ${{ runner.os }}-sonar-${{ hashFiles('**/*.gradle*') }} | |
- name: Grant executable permission | |
run: chmod +x gradlew plugin/src/integrationTest/resources/*/bin/* | |
- name: Build plugin on Linux (with test coverage) | |
if: matrix.os == 'ubuntu-22.04' | |
run: ./gradlew :plugin:jacocoTestReport --console=plain | |
- name: Build plugin on MacOS | |
if: matrix.os == 'macos-14' | |
run: ./gradlew :plugin:build --console=plain | |
- name: Build plugin on Windows | |
if: matrix.os == 'windows-2022' | |
run: | | |
Remove-Item Env:npm_config_prefix | |
./gradlew :plugin:build --console=plain | |
- name: Scan source code and test results | |
if: matrix.os == 'ubuntu-22.04' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew :plugin:sonar --console=plain -Dorg.gradle.jvmargs=-Xmx512m |