Merge pull request #3254 from LorenzoBettini/lb_3253 #2393
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: ['*'] # Run on any pushed branch, but not on any pushed tag | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build: | |
strategy: | |
matrix: # 'macos-14' is arm64 | |
os: ['ubuntu-22.04', 'macos-14', 'windows-2022'] | |
java: [ 21 ] | |
additional-maven-args: [''] | |
include: | |
- os: ubuntu-22.04 | |
java: 21 | |
additional-maven-args: -Pstrict-jdk-21 | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: 'Check out repository' | |
uses: actions/checkout@v4 | |
- name: 'Set up Java ${{ matrix.java }}' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: 'Cache Maven packages' | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ matrix.java }}-${{ hashFiles('**/pom.xml', '**/*.target') }} | |
- name: Set Maven Home environment variable | |
run: echo "MAVEN_WRAPPER_HOME=$(./mvnw --version | grep "Maven home:" | cut -c 13-)" >> "$GITHUB_ENV" | |
if: runner.os != 'Windows' | |
- name: Set Maven Home environment variable on Windows | |
run: echo "MAVEN_WRAPPER_HOME=$(./mvnw --version | grep "Maven home:" | cut -c 13-)" | Out-File -FilePath $env:GITHUB_ENV -Append | |
# In Windows the syntax for setting environment variable is different | |
if: runner.os == 'Windows' | |
- name: Build and test | |
uses: coactions/[email protected] | |
with: | |
run: > | |
./mvnw "-Dmaven.home=${{ env.MAVEN_WRAPPER_HOME }}" | |
clean verify | |
-f org.eclipse.xtext.full.releng | |
-B -fae -PuseJenkinsSnapshots | |
${{ matrix.additional-maven-args }} | |
- name: Archive Test Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results-${{ runner.os }}-${{ matrix.java }} | |
path: '**/*.tests/target/surefire-reports' | |
- name: Archive Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() || cancelled() }} | |
with: | |
name: logs-${{ runner.os }}-${{ matrix.java }} | |
path: '**/*.tests/target/**/*.log' | |
build-maven-artifacts: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: 'Check out repository' | |
uses: actions/checkout@v4 | |
- name: 'Set up Java' | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'temurin' | |
- name: 'Cache Maven packages' | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.target') }} | |
- name: Set Maven Home environment variable | |
run: echo "MAVEN_WRAPPER_HOME=$(./mvnw --version | grep "Maven home:" | cut -c 13-)" >> "$GITHUB_ENV" | |
- name: Build Maven artifacts | |
run: > | |
./mvnw "-Dmaven.home=${{ env.MAVEN_WRAPPER_HOME }}" | |
clean verify | |
-f org.eclipse.xtext.maven.releng | |
-B -fae -PuseJenkinsSnapshots | |
-Pstrict-jdk-21 | |
- name: Archive Test Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: build-maven-artifacts-test-results-${{ runner.os }} | |
path: '**/target/surefire-reports' | |
- name: Archive Logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() || cancelled() }} | |
with: | |
name: build-maven-artifacts-logs-${{ runner.os }} | |
path: '**/target/**/*.log' | |
event_file: | |
name: "Upload Event File" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} |