Refactor GitHub Action Workflows (#271) #520
This file contains hidden or 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: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- '**' | |
# don't run on dependabot branches. Dependabot will create pull requests, which will then be run instead | |
- '!dependabot/**' | |
tags: | |
- '**' | |
workflow_dispatch: | |
schedule: | |
# build it monthly: At 05:00 on day-of-month 1. | |
- cron: '0 5 1 * *' | |
# if another commit is added to the same branch or PR (same github.ref), | |
# then cancel already running jobs and start a new build. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
env: | |
LANG: 'en_US.UTF-8' | |
jobs: | |
# verify build on one node before multiple builds on different os are started | |
fail-fast-build: | |
name: verify (ubuntu-latest, 2025-03) | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Environment | |
uses: ./.github/actions/setup | |
- name: Build | |
run: | | |
${xvfb_cmd} ./mvnw --show-version --errors --batch-mode \ | |
verify | |
- name: Upload screenshots of failed unit tests | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() }} | |
with: | |
name: screenshots-ubuntu-latest | |
path: net.sourceforge.pmd.eclipse.plugin.test/screenshots | |
if-no-files-found: ignore | |
- name: Upload update-site | |
uses: actions/upload-artifact@v4 | |
with: | |
name: update-site | |
path: net.sourceforge.pmd.eclipse.p2updatesite/target/net.sourceforge.pmd.eclipse.p2updatesite-*.zip | |
build: | |
needs: fail-fast-build | |
name: verify (${{ matrix.os }}, ${{ matrix.targetPlatform }}) | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash | |
continue-on-error: false | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
targetPlatform: [ 2025-03 ] | |
exclude: | |
# exclude the fail-fast-build, which already ran | |
- os: ubuntu-latest | |
targetPlatform: 2025-03 | |
# run other target platforms only on linux | |
include: | |
- os: ubuntu-latest | |
targetPlatform: 2024-12 | |
- os: ubuntu-latest | |
targetPlatform: 2024-09 | |
- os: ubuntu-latest | |
targetPlatform: 2024-06 | |
fail-fast: true | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Environment | |
uses: ./.github/actions/setup | |
- name: Build | |
env: | |
TARGET_PLATFORM: ${{ matrix.targetPlatform }} | |
run: | | |
${xvfb_cmd} ./mvnw --show-version --errors --batch-mode \ | |
verify \ | |
-Dtarget.platform="${TARGET_PLATFORM}" | |
- name: Upload screenshots of failed unit tests | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() }} | |
with: | |
name: screenshots-${{ matrix.os }}-${{ matrix.targetPlatform }} | |
path: net.sourceforge.pmd.eclipse.plugin.test/screenshots | |
if-no-files-found: ignore |