Merge pull request #1380 from gsmet/ecosystem-ci-3.15 #3291
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: "CI Build" | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
paths-ignore: | |
- '.gitignore' | |
- '*.md' | |
- '*.adoc' | |
- '*.txt' | |
- '.github/ISSUE_TEMPLATE/**' | |
pull_request: | |
paths-ignore: | |
- '.gitignore' | |
- '*.md' | |
- '*.adoc' | |
- '*.txt' | |
- '.github/ISSUE_TEMPLATE/**' | |
defaults: | |
run: | |
shell: bash | |
env: | |
LANG: en_US.UTF-8 | |
jobs: | |
# This is a hack to work around a GitHub API limitation: | |
# when the PR is coming from another fork, the pull_requests field of the | |
# workflow_run payload is empty. | |
# For more details, see | |
# https://github.community/t/pull-request-attribute-empty-in-workflow-run-event-object-for-pr-from-forked-repo/154682 | |
attach-pr-number: | |
runs-on: ubuntu-latest | |
name: Attach pull request number | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Create file | |
run: | | |
echo -n ${{ github.event.number }} > pull-request-number | |
- name: Upload pull request number | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pull-request-number-${{ github.event.number }} | |
path: pull-request-number | |
retention-days: 1 | |
build: | |
name: Build - JDK ${{ matrix.java }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [ 17 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Reclaim Disk Space | |
run: .github/ci-prerequisites.sh | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT | |
- name: Cache Maven Repository | |
id: cache-maven | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
# refresh cache every month to avoid unlimited growth | |
key: maven-repo-pr-${{ runner.os }}-${{ steps.get-date.outputs.date }} | |
- name: Install JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.java }} | |
- name: Build with Maven | |
run: MAVEN_OPTS=-Xmx4096m && ./mvnw -B clean install --settings .github/mvn-settings.xml --fail-at-end | |
- name: Delete Local Artifacts From Cache | |
run: rm -rf ~/.m2/repository/io/quarkus/quarkus-universe-bom* | |
- name: Upload build reports (if build failed) | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: "build-reports-${{ github.run_attempt }}-Build - JDK ${{ matrix.java }}" | |
path: | | |
**/target/*-reports/TEST-*.xml | |
target/build-report.json | |
LICENSE | |
retention-days: 2 | |
refresh: | |
name: Check generated project has been updated | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y-%m")" >> $GITHUB_OUTPUT | |
- name: Cache Maven Repository | |
id: cache-maven | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
# refresh cache every month to avoid unlimited growth | |
key: maven-repo-pr-${{ runner.os }}-${{ steps.get-date.outputs.date }} | |
- name: Install JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Build with Maven | |
run: MAVEN_OPTS=-Xmx3072m && ./mvnw -B clean process-resources --settings .github/mvn-settings.xml | |
- name: Get changes | |
id: get-changes | |
run: | | |
echo "changes=$(git status -s | wc -l)" >> $GITHUB_OUTPUT | |
- name: Display changes | |
run: | | |
git status | |
git --no-pager diff | |
- name: Check that generated project is properly updated | |
uses: actions/github-script@v7 | |
if: ${{ steps.get-changes.outputs.changes > 0 }} | |
with: | |
script: | | |
throw new Error('Generated project needs an update. Please run ./mvnw -Dsync and include the result in your pull request.') | |
build-report: | |
runs-on: ubuntu-latest | |
name: Build report | |
needs: [build, refresh] | |
if: always() | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: build-reports-artifacts | |
pattern: "build-reports-${{ github.run_attempt }}-*" | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Produce report and add it as job summary | |
uses: quarkusio/action-build-reporter@main | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
build-reports-artifacts-path: build-reports-artifacts |