Skip to content

Test pipeline

Test pipeline #23

Workflow file for this run

name: Continuous Integration Build Pipeline
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
defaults:
run:
shell: bash
env:
JAVA_VERSION: '17'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn clean install
- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: target/*.jar
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
cache: maven
- name: Run Tests
run: mvn test
- name: Upload Surefire test results
if: always()
uses: actions/upload-artifact@v4
with:
name: surefire-reports
path: target/surefire-reports/
- name: Upload JaCoCo reports
if: always()
uses: actions/upload-artifact@v4
with:
name: jacoco-reports
path: target/site/jacoco/
code-scan:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download JaCoCo reports
uses: actions/download-artifact@v4
with:
name: jacoco-reports
path: target/site/jacoco/
- name: Setup Code Climate
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run Code Climate Analysis
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
JACOCO_SOURCE_PATH=src/main/java ./cc-test-reporter format-coverage target/site/jacoco/jacoco.xml --input-type jacoco
./cc-test-reporter upload-coverage
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Snyk CLI
run: npm install -g snyk
- name: Run Snyk dependency scan
id: snyk-deps
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: snyk test --severity-threshold=high --sarif-file-output=snyk-deps.sarif
- name: Upload dependency scan results
uses: github/codeql-action/upload-sarif@v3
if: always() && steps.snyk-deps.outcome != 'skipped'
with:
sarif_file: snyk-deps.sarif
category: snyk-deps
- name: Run Snyk code analysis
id: snyk-code
continue-on-error: true
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
run: snyk code test --org=e51df284-6453-4ef1-8eff-ebbb773df8f9 --severity-threshold=high --sarif-file-output=snyk-code.sarif
- name: Upload code scan results
uses: github/codeql-action/upload-sarif@v3
if: always() && steps.snyk-code.outcome != 'skipped'
with:
sarif_file: snyk-code.sarif
category: snyk-code