Skip to content

code-coverage

code-coverage #575

Workflow file for this run

# 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: code-coverage
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
pull_request:
paths:
- '.github/workflows/code-coverage.yml'
env:
DEFAULT_MAVEN_OPTS: >-
-Xms6g
-Xmx6g
-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN
DEVELOCITY_ACCESS_KEY: ${{ secrets.NIFI_DEVELOCITY_ACCESS_KEY }}
permissions:
contents: read
jobs:
unit-tests:
timeout-minutes: 120
runs-on: ubuntu-24.04
name: Run Unit Tests
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set up Java 21
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
cache: 'maven'
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Maven Build
env:
MAVEN_OPTS: >-
${{ env.DEFAULT_MAVEN_OPTS }}
run: >
./mvnw --fail-fast --no-snapshot-updates --no-transfer-progress --show-version
--threads 1C
-P report-code-coverage
jacoco:prepare-agent
verify
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
if: github.repository_owner == 'apache'
with:
files: ./nifi-code-coverage/target/site/jacoco-aggregate/jacoco.xml
flags: unit-tests
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
integration-tests:
timeout-minutes: 120
runs-on: ubuntu-24.04
name: Run Integration Tests
env:
MAVEN_BUILD_ARGUMENTS: >-
verify
-P skip-unit-tests
-P integration-tests
-P nifi-registry-integration-tests
-P report-code-coverage
MAVEN_BUILD_EXCLUDE_PROJECTS: >-
-pl -:minifi-assembly
-pl -:nifi-assembly
-pl -:nifi-toolkit-assembly
-pl -:nifi-registry-assembly
-pl -:nifi-registry-toolkit-assembly
-pl -:nifi-runtime-manifest
-pl -:nifi-runtime-manifest-test
-pl -:nifi-stateless-assembly
-pl -:nifi-stateless-system-test-suite
-pl -:nifi-system-test-suite
-pl -:nifi-nar-provider-assembly
-pl -:nifi-py4j-integration-tests
-pl -:nifi-docs
-pl -:nifi-maven-archetypes
-pl -:nifi-processor-bundle-archetype
-pl -:nifi-service-bundle-archetype
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set up Java 21
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
cache: 'maven'
- name: Maven Integration Tests with Coverage
env:
MAVEN_OPTS: >-
${{ env.DEFAULT_MAVEN_OPTS }}
TESTCONTAINERS_REUSE_ENABLE: true
run: >
./mvnw --fail-fast --no-snapshot-updates --no-transfer-progress --show-version
${{ env.MAVEN_BUILD_ARGUMENTS }}
${{ env.MAVEN_BUILD_EXCLUDE_PROJECTS }}
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
if: github.repository_owner == 'apache'
with:
files: ./nifi-code-coverage/target/site/jacoco-aggregate/jacoco.xml
flags: integration-tests
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
system-tests:
timeout-minutes: 120
runs-on: ubuntu-24.04
name: Run System Tests
env:
MAVEN_BUILD_ARGUMENTS: >-
install
-D skipTests
-pl nifi-code-coverage
-am
MAVEN_RUN_ARGUMENTS: >-
verify
-P integration-tests
-P report-code-coverage
-D include-python-integration-tests=true
MAVEN_PROJECTS: >-
-pl :nifi-python-framework
-pl :nifi-python-extension-api
-pl :nifi-python-test-extensions
-pl :nifi-py4j-integration-tests
-pl nifi-system-tests/nifi-system-test-suite
-pl nifi-system-tests/nifi-stateless-system-test-suite
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set up Java 21
uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
cache: 'maven'
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Set up Astral uv
uses: astral-sh/setup-uv@v5
with:
python-version: '3.10'
enable-cache: false
- name: Build Dependencies
env:
MAVEN_OPTS: >-
${{ env.DEFAULT_MAVEN_OPTS }}
run: >
./mvnw
-V
-nsu
-ntp
-ff
${{ env.MAVEN_BUILD_ARGUMENTS }}
${{ env.MAVEN_PROJECTS }}
- name: Download JaCoCo Agent
run: |
JACOCO_VERSION=$(./mvnw help:evaluate -Dexpression=jacoco.version -q -DforceStdout 2>/dev/null)
./mvnw dependency:copy -Dartifact=org.jacoco:org.jacoco.agent:${JACOCO_VERSION}:jar:runtime -DoutputDirectory=target/jacoco-agent
echo "JACOCO_AGENT_PATH=$(pwd)/target/jacoco-agent/org.jacoco.agent-${JACOCO_VERSION}-runtime.jar" >> $GITHUB_ENV
- name: Run System Tests with Coverage
env:
MAVEN_OPTS: >-
${{ env.DEFAULT_MAVEN_OPTS }}
JACOCO_AGENT_PATH: ${{ env.JACOCO_AGENT_PATH }}
run: >
./mvnw
-V
-nsu
-ntp
-ff
${{ env.MAVEN_RUN_ARGUMENTS }}
${{ env.MAVEN_PROJECTS }}
- name: Collect and Convert Coverage Files
if: always()
run: .github/scripts/collect-system-tests-coverage.sh
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
if: github.repository_owner == 'apache'
with:
files: target/system-tests-coverage/jacoco.xml
flags: system-tests
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true