Merge pull request #1582 from DependencyTrack/dependabot/github_actio… #3168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is part of Dependency-Track. | |
# | |
# Licensed 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. | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# Copyright (c) OWASP Foundation. All Rights Reserved. | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- "feature-**" | |
pull_request: | |
branches: | |
- main | |
- "feature-**" | |
permissions: { } | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # tag=v4.5.0 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Test | |
run: |- | |
mvn -B --no-transfer-progress -pl '!e2e' clean verify \ | |
failsafe:integration-test -DskipITs=false | |
# Publishing coverage to Codacy is only possible for builds of push events. | |
# PRs from forks do not get access to repository secrets. | |
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
- name: Publish test coverage | |
if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'DependencyTrack' }} | |
run: |- | |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \ | |
--project-token ${{ secrets.CODACY_PROJECT_TOKEN }} \ | |
--commit-uuid ${{ github.sha }} \ | |
--coverage-reports **/target/site/jacoco/jacoco.xml \ | |
--language Java | |
- name: Save PR details | |
if: ${{ github.event_name == 'pull_request' }} | |
run: |- | |
echo ${{ github.sha }} > pr-commit.txt | |
echo ${{ github.event.number }} > PR_NUMBER.txt | |
- name: Upload PR test coverage report | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr-test-coverage-report | |
path: |- | |
pr-commit.txt | |
PR_NUMBER.txt | |
**/target/site/jacoco/jacoco.xml | |
test-native-image: | |
name: Test Native Image | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' }} | |
timeout-minutes: 20 | |
strategy: | |
matrix: | |
module: | |
- mirror-service | |
- notification-publisher | |
- repository-meta-analyzer | |
- vulnerability-analyzer | |
fail-fast: true | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # tag=v4.5.0 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Set up GraalVM | |
uses: graalvm/setup-graalvm@557ffcf459751b4d92319ee255bf3bec9b73964c # tag=v1 | |
with: | |
# NOTE: Do NOT use the Oracle GraalVM distribution, as that is causing issues | |
# with Protobuf serialization. | |
# https://github.com/DependencyTrack/hyades/issues/641 | |
# https://github.com/quarkusio/quarkus/issues/35125 | |
distribution: 'mandrel' | |
version: 'mandrel-23.1.2.0-Final' | |
java-version: '21' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Modules | |
run: |- | |
mvn -B --no-transfer-progress clean install -DskipTests | |
- name: Build Native Image | |
run: |- | |
mvn -B --no-transfer-progress -pl ${{ matrix.module }} package -Dnative -DskipTests | |
- name: Test Native Image | |
run: |- | |
mvn -B --no-transfer-progress -pl ${{ matrix.module }} \ | |
test-compile failsafe:integration-test failsafe:verify -Dnative |