You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/10/14 17:53:51 UTC

[GitHub] [zookeeper] ctubbsii commented on a change in pull request #1501: Add Gitub Actions for PR validation

ctubbsii commented on a change in pull request #1501:
URL: https://github.com/apache/zookeeper/pull/1501#discussion_r504861740



##########
File path: .github/workflows/pr-validation.yml
##########
@@ -0,0 +1,38 @@
+#
+# 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: [push, pull_request]
+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: 'cache'
+          restore-keys: 'cache'
+      - name: 'Build with Maven'
+        run: mvn -B install --file pom.xml
+      - name: 'Remove Snapshots Before Caching'
+        run: find ~/.m2 -name '*SNAPSHOT' | xargs rm -Rf

Review comment:
       You can avoid having to remove the SNAPSHOT versions if you simply don't `install` them in the first place. You almost never need to actually do a `mvn install`, as you should be using `mvn verify` instead. `mvn verify` will do all the steps that `mvn install` will do, except saving the files in the local repository. The only time you need to do `mvn install` is if you are doing it to make the artifacts available for a subsequent `mvn` execution that depends on these artifacts, and you haven't deployed them yet.
   
   ```suggestion
           run: mvn -B -ntp verify
   ```

##########
File path: .github/workflows/pr-validation.yml
##########
@@ -0,0 +1,38 @@
+#
+# 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: [push, pull_request]
+env:
+  MAVEN_OPTS: -Dmaven.artifact.threads=256 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

Review comment:
       The slf4j logger doesn't need to be set here. You can use `mvn -ntp` with the latest versions of Maven, such as 3.6.3, which I believe will be used in `ubuntu-latest`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org