You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ji...@apache.org on 2021/06/28 19:41:11 UTC

[daffodil] 01/01: Bump sonarsource/sonarcloud-github-action from 1.5 to 1.6

This is an automated email from the ASF dual-hosted git repository.

jinterrante pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/daffodil.git

commit 8e890d5576c4191ba4816d2031096dd59f529b3f
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Wed Jun 23 19:04:04 2021 +0000

    Bump sonarsource/sonarcloud-github-action from 1.5 to 1.6
    
    Bumps [sonarsource/sonarcloud-github-action](https://github.com/sonarsource/sonarcloud-github-action) from 1.5 to 1.6.
    - [Release notes](https://github.com/sonarsource/sonarcloud-github-action/releases)
    - [Commits](https://github.com/sonarsource/sonarcloud-github-action/compare/v1.5...v1.6)
    
    ---
    updated-dependencies:
    - dependency-name: sonarsource/sonarcloud-github-action
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    - Adds setup-java back so that it is consistent with main.yml
    - Ensures we only run sonarcloud one pushes to master. PR's don't have
      sufficient priviledges so will fail
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    
    With additional changes to improve how Sonar scan is run
    
    main.yml: Change "on" clause to avoid running all checks twice on
    Dependabot PRs.  Define SBT the same way as sonarcloud.yml (without
    coverage) and simply use "$SBT coverage" whereever coverage is needed
    for goals.  Get rid of SBTNOCOV since it's not needed anymore.
    
    Disable shallow clone in checkout as recommended to improve
    sonarcloud's reporting.  Run coverageReport to generate each module's
    scoverage.xml report.  Fix file paths in scoverage.xml reports so
    sonar-github-action's Docker container will be able to resolve them.
    Remove sonarcloud.yml and move its sonarcloud-github-action step into
    main.yml instead.
    
    sonar-project.properties: Add sonar.scala.coverage.reportPaths
    property defining path to each module's scoverage.xml report.
---
 .github/workflows/main.yml       | 55 ++++++++++++++++++++++++++++--------
 .github/workflows/sonarcloud.yml | 60 ----------------------------------------
 sonar-project.properties         |  2 ++
 3 files changed, 45 insertions(+), 72 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 6695304..6099dbc 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -15,10 +15,19 @@
 
 name: Daffodil CI
 
-on: [push, pull_request]
+# Run CI when pushing a commit to master or creating a pull request or
+# adding another commit to a pull request or reopening a pull request.
+
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    types: [opened, synchronize, reopened]
+
+# Build Daffodil and run some checks.
 
 jobs:
-  test:
+  check:
     name: Java ${{ matrix.java_version }}, Scala ${{ matrix.scala_version }}, ${{ matrix.os }}
     strategy:
       fail-fast: false
@@ -44,8 +53,8 @@ jobs:
     env:
       AR: ${{ matrix.env_ar }}
       CC: ${{ matrix.env_cc }}
-      SBT: sbt -J-Xms1024m -J-Xmx5120m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m ++${{ matrix.scala_version }} coverage
-      SBTNOCOV: sbt -J-Xms1024m -J-Xmx5120m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m ++${{ matrix.scala_version }}
+      SBT: sbt -J-Xms1024m -J-Xmx5120m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m ++${{ matrix.scala_version }}
+
     steps:
 
       ############################################################
@@ -89,41 +98,63 @@ jobs:
           distribution: ${{ matrix.distribution }}
           java-version: ${{ matrix.java_version }}
 
+      # Cache Action - tried on 2021-06-28, removed because it didn't help
+      # 1. Tried coursier/cache-action but Apache didn't allow it
+      #    extraSbtFiles: daffodil-cli/build.sbt daffodil-japi/build.sbt
+      # 2. Tried actions/cache but it didn't speed up CI at all
+      #    path: ~/.cache/coursier ~/.ivy2/cache ~/.sbt 
+
       - name: Check out Repository
         uses: actions/checkout@v2.3.4
+        # Disabling shallow clone is recommended for improving reporting
+        with:
+          fetch-depth: 0
 
       ############################################################
       # Build & Package
       ############################################################
 
       - name: Compile
-        run: $SBT compile Test/compile IntegrationTest/compile
+        run: $SBT coverage compile Test/compile IntegrationTest/compile
 
       - name: Build Documentation
-        run: $SBTNOCOV unidoc
+        run: $SBT unidoc
 
       - name: Package Zip & Tar
-        run: $SBTNOCOV daffodil-cli/Universal/packageBin daffodil-cli/Universal/packageZipTarball
+        run: $SBT daffodil-cli/Universal/packageBin daffodil-cli/Universal/packageZipTarball
 
       - name: Package RPM (Linux)
         if: runner.os == 'Linux'
-        run: $SBTNOCOV daffodil-cli/Rpm/packageBin
+        run: $SBT daffodil-cli/Rpm/packageBin
 
       ############################################################
-      # Test
+      # Check
       ############################################################
 
       - name: Run Rat Check
-        run: $SBTNOCOV ratCheck || (cat target/rat.txt; exit 1)
+        run: $SBT ratCheck || (cat target/rat.txt; exit 1)
 
       - name: Run Unit Tests
-        run: $SBT test
+        run: $SBT coverage test
 
       - name: Run Integration Tests
-        run: $SBT IntegrationTest/test
+        run: $SBT coverage IntegrationTest/test
 
       - name: Generate Coverage Report
         run: $SBT coverageAggregate
 
       - name: Upload Coverage Report
         uses: codecov/codecov-action@v1.5.2
+
+      - name: Prepare for SonarCloud Scan
+        if: ${{ runner.os == 'Linux' && matrix.java_version == '11' && github.repository == 'apache/daffodil' }}
+        run: |
+          $SBT coverageReport
+          find . -name scoverage.xml -exec sed -i 's#/home/runner/work/daffodil/daffodil#/github/workspace#g' {} +
+
+      - name: Run SonarCloud Scan
+        if: ${{ runner.os == 'Linux' && matrix.java_version == '11' && github.repository == 'apache/daffodil' }}
+        uses: sonarsource/sonarcloud-github-action@v1.6
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
deleted file mode 100644
index 6fd2787..0000000
--- a/.github/workflows/sonarcloud.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-# 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: SonarCloud Workflow
-
-on: [push]
-
-jobs:
-  sonarCloudTrigger:
-    if: github.repository == 'apache/daffodil'
-    name: SonarCloud Scan, Scala ${{ matrix.scala_version }}, ${{ matrix.os }}
-    strategy:
-      matrix:
-        scala_version: [ 2.12.14 ]
-        os: [ ubuntu-20.04 ]
-
-    runs-on: ${{ matrix.os }}
-    steps:
-
-      ############################################################
-      # Setup
-      ############################################################
-
-      - name: Install Dependencies (Linux)
-        if: runner.os == 'Linux'
-        run: sudo apt-get install -y libmxml-dev
-
-      - name: Check out Repository
-        uses: actions/checkout@v2.3.4
-        # Disabling shallow clone is recommended for improving reporting
-        with:
-          fetch-depth: 0
-
-      ############################################################
-      # Build & Scan
-      ############################################################
-
-      - name: Compile
-        run: $SBT compile Test/compile IntegrationTest/compile
-        env:
-          SBT: sbt -J-Xms1024m -J-Xmx5120m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m ++${{ matrix.scala_version }}
-
-      - name: SonarCloud Scan
-        uses: sonarsource/sonarcloud-github-action@v1.5
-        # Don't setup Java since its env vars will screw up sonarcloud action
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
diff --git a/sonar-project.properties b/sonar-project.properties
index 2db8710..fa01312 100644
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -34,3 +34,5 @@ sonar.java.binaries=target/**/classes
 sonar.java.test.binaries=target/**/test-classes
 sonar.java.libraries=../lib_managed/jars/**/*.jar
 sonar.java.test.libraries=../lib_managed/jars/**/*.jar
+
+sonar.scala.coverage.reportPaths=target/scala-2.12/scoverage-report/scoverage.xml