From dcc313b6894c4063572173101e1a2b87e548b0b7 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 17:38:20 +0200 Subject: [PATCH 1/9] OPENJPA-2819 Add simple GitHub Actions validation for Pull Requests --- .github/workflows/pr-validation.yml | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/pr-validation.yml diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 000000000..635b5086b --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with this work for additional +# information regarding copyright ownership. The ASF licenses this file to you +# under the Apache License, Version 2.0 (the # "License"); you may not use this +# file except in compliance with the License. You may obtain a copy of the License +# at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. +# +name: Java CI + +on: + pull_request: + branches: [ $default-branch ] + +env: + MAVEN_OPTS: -Dmaven.artifact.threads=256 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build with Maven + run: mvn -B package --file pom.xml From 6ec962f14f9397efb9994ede3a360a52eba03af6 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 18:00:34 +0200 Subject: [PATCH 2/9] remove snapshots --- .github/workflows/pr-validation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 635b5086b..6c97848bf 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -40,3 +40,5 @@ jobs: restore-keys: ${{ runner.os }}-m2 - name: Build with Maven run: mvn -B package --file pom.xml + - name: Remove Snapshots Before Caching + run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf From c97bb58a35241e0925057401dfe1a8f94afedff3 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 18:04:50 +0200 Subject: [PATCH 3/9] hard code key cache --- .github/workflows/pr-validation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 6c97848bf..98bea071c 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -36,8 +36,8 @@ jobs: uses: actions/cache@v2 with: path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 + key: 'cache' + restore-keys: 'cache' - name: Build with Maven run: mvn -B package --file pom.xml - name: Remove Snapshots Before Caching From 6ddfe4e0a05bd021131414a97b426539b8eca6e1 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 18:09:50 +0200 Subject: [PATCH 4/9] add quotes --- .github/workflows/pr-validation.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 98bea071c..ecf51060d 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -28,17 +28,17 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 + - name: 'Set up JDK 1.8' uses: actions/setup-java@v1 with: - java-version: 1.8 - - name: Cache Maven packages + java-version: '1.8' + - name: 'Cache Maven packages' uses: actions/cache@v2 with: path: ~/.m2 key: 'cache' restore-keys: 'cache' - - name: Build with Maven + - name: 'Build with Maven' run: mvn -B package --file pom.xml - - name: Remove Snapshots Before Caching + - name: 'Remove Snapshots Before Caching' run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf From d4882b0acec6ace347517c4f9b352a693bf9a6a6 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 18:13:07 +0200 Subject: [PATCH 5/9] indent --- .github/workflows/pr-validation.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ecf51060d..30d57dc16 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -14,27 +14,23 @@ # specific language governing permissions and limitations under the License. # name: Java CI - on: pull_request: branches: [ $default-branch ] - env: MAVEN_OPTS: -Dmaven.artifact.threads=256 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - jobs: build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: 'Set up JDK 1.8' uses: actions/setup-java@v1 with: java-version: '1.8' - - name: 'Cache Maven packages' - uses: actions/cache@v2 - with: + - name: 'Cache Maven packages' + uses: actions/cache@v2 + with: path: ~/.m2 key: 'cache' restore-keys: 'cache' From 29ca489fc61b4ba78f5b41cef6fd7a8b8cb165b9 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 18:28:41 +0200 Subject: [PATCH 6/9] better clause --- .github/workflows/pr-validation.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 30d57dc16..bc8b35469 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -14,9 +14,7 @@ # specific language governing permissions and limitations under the License. # name: Java CI -on: - pull_request: - branches: [ $default-branch ] +on: [push, pull_request] env: MAVEN_OPTS: -Dmaven.artifact.threads=256 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn jobs: From 5263d8ca27e3e2f72a9641465f5ab397f71a4525 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 20:45:31 +0200 Subject: [PATCH 7/9] Switch to verify --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index bc8b35469..3e66d6fff 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -33,6 +33,6 @@ jobs: key: 'cache' restore-keys: 'cache' - name: 'Build with Maven' - run: mvn -B package --file pom.xml + run: mvn -B verify --file pom.xml - name: 'Remove Snapshots Before Caching' run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf From 78225920f9ee7eed53686c95291e36878b595d4d Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 22:25:20 +0200 Subject: [PATCH 8/9] use 'package' with 'verify' the build fails as we need the jar --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 3e66d6fff..bc8b35469 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -33,6 +33,6 @@ jobs: key: 'cache' restore-keys: 'cache' - name: 'Build with Maven' - run: mvn -B verify --file pom.xml + run: mvn -B package --file pom.xml - name: 'Remove Snapshots Before Caching' run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf From 80c7d3c9bb624b5a27112e5db318ceb5137f57e0 Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Fri, 17 Jul 2020 23:02:34 +0200 Subject: [PATCH 9/9] use 'install' goal --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index bc8b35469..1593a46e1 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -33,6 +33,6 @@ jobs: key: 'cache' restore-keys: 'cache' - name: 'Build with Maven' - run: mvn -B package --file pom.xml + run: mvn -B install --file pom.xml - name: 'Remove Snapshots Before Caching' run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf