You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2021/12/01 10:08:45 UTC
[maven] 01/01: Fix github workflow
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch MNG-7129-maven-caching
in repository https://gitbox.apache.org/repos/asf/maven.git
commit 4ba91ed9f1a345a0664c655944b8e83a609e8f8f
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Dec 1 10:37:23 2021 +0100
Fix github workflow
---
.github/workflows/maven.yml | 125 +++++++-------------------------------------
1 file changed, 19 insertions(+), 106 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index addba89..a42c97f 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -24,124 +24,37 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
+ java: [11, 17]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-java@v2
- with:
- java-version: 8
- distribution: 'temurin'
- cache: 'maven'
-
- - name: Build with Maven
- run: mvn verify -e -B -V -DdistributionFileName=apache-maven
-
- - name: Upload built Maven
- uses: actions/upload-artifact@v2
- if: ${{ matrix.os == 'ubuntu-latest' }}
- with:
- name: built-maven
- path: apache-maven/target/
-
- - name: Upload built Apache Maven Wrapper
- uses: actions/upload-artifact@v2
- if: ${{ matrix.os == 'ubuntu-latest' }}
- with:
- name: built-apache-maven-wrapper
- path: apache-maven-wrapper/target/
-
- - name: Upload built Maven Wrapper
- uses: actions/upload-artifact@v2
- if: ${{ matrix.os == 'ubuntu-latest' }}
+ - name: Checkout
+ uses: actions/checkout@v2
with:
- name: built-maven-wrapper
- path: maven-wrapper/target/maven-wrapper.jar
-
- integration-test:
- needs: build
- strategy:
- matrix:
- os: [ubuntu-latest, windows-latest, macOS-latest]
- java: [8, 11, 17]
-
- fail-fast: false
- runs-on: ${{ matrix.os }}
-
- steps:
- - name: Collect environment context variables
- shell: bash
- env:
- PR_HEAD_LABEL: ${{ github.event.pull_request.head.label }}
- run: |
- set +e
- repo=maven-integration-testing
- target_branch=master
- target_user=apache
- if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
- user=${PR_HEAD_LABEL%:*}
- branch=${PR_HEAD_LABEL#*:}
- else
- user=${GITHUB_REPOSITORY%/*}
- branch=${GITHUB_REF#refs/heads/}
- fi
- if [ $branch != "master" ]; then
- git ls-remote https://github.com/$user/$repo.git | grep "refs/heads/${branch}$" > /dev/null
- if [ $? -eq 0 ]; then
- echo "Found a branch \"$branch\" in fork \"$user/$repo\", configuring this for the integration tests to be run against."
- target_branch=$branch
- target_user=$user
- else
- echo "Could not find fork \"$user/$repo\" or a branch \"$branch\" in this fork. Falling back to \"$target_branch\" in \"$target_user/$repo\"."
- fi
- else
- echo "Integration tests will run against $target_user/$repo for master builds."
- fi
- echo "REPO_BRANCH=$target_branch" >> $GITHUB_ENV
- echo "REPO_USER=$target_user" >> $GITHUB_ENV
+ submodules: recursive
- - name: Checkout maven-integration-testing
- uses: actions/checkout@v2
+ - name: Setup Java
+ uses: actions/setup-java@v2
with:
- repository: ${{ env.REPO_USER }}/maven-integration-testing
- path: maven-integration-testing/
- ref: ${{ env.REPO_BRANCH }}
+ java-version: ${{ matrix.java }}
+ distribution: 'temurin'
+ cache: 'maven'
- - name: Set up cache for ~/.m2/repository
- uses: actions/cache@v2
+ - name: Cache maven local repository
+ uses: actions/cache@v1
with:
path: ~/.m2/repository
- key: it-m2-repo-${{ matrix.os }}-${{ hashFiles('maven-integration-testing/**/pom.xml') }}
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
- it-m2-repo-${{ matrix.os }}-
+ ${{ runner.os }}-maven-
- - name: Download built Maven
- uses: actions/download-artifact@v2
- with:
- name: built-maven
- path: built-maven/
-
- - name: Download built Apache Maven Wrapper
- uses: actions/download-artifact@v2
- with:
- name: built-apache-maven-wrapper
- path: built-apache-maven-wrapper/
-
- - name: Download built Maven Wrapper
- uses: actions/download-artifact@v2
- with:
- name: built-maven-wrapper
- path: built-maven-wrapper/
+ - name: Build maven distributions
+ run: |
+ mvn install -DskipTests -P versionlessMavenDist -f "maven/maven3"
+ mvn install -DskipTests -P versionlessMavenDist -f "maven/maven4"
- - name: Set up JDK
- uses: actions/setup-java@v2
- with:
- java-version: ${{ matrix.java }}
- distribution: 'temurin'
- cache: 'maven'
+ - name: Build with Maven
+ run: mvn install -e -B -V
- - name: Running integration tests
- shell: bash
- run: mvn install -e -B -V -Prun-its,embedded -Dmaven.repo.local="$HOME/.m2/repository" -DmavenDistro="$GITHUB_WORKSPACE/built-maven/apache-maven-bin.zip" -DwrapperDistroDir="$GITHUB_WORKSPACE/built-apache-maven-wrapper/" -DmavenWrapper="$GITHUB_WORKSPACE/built-maven-wrapper/maven-wrapper.jar" -f maven-integration-testing/pom.xml