Test pipeline #11
This file contains hidden or 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
name: Continuous Integration Build Pipeline | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
JAVA_VERSION: '17' | ||
UBUNTU_VERSION: 'ubuntu-22.04' | ||
jobs: | ||
build: | ||
runs-on: ${{ env.UBUNTU_VERSION }} | ||
Check failure on line 19 in .github/workflows/build.yml
|
||
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: ${{ env.UBUNTU_VERSION }} | ||
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: build | ||
runs-on: u${{ env.UBUNTU_VERSION }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- 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: Upload coverage to Code Climate | ||
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: | ||
needs: build | ||
runs-on: ${{ env.UBUNTU_VERSION }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Snyk CLI | ||
run: npm install -g snyk | ||
- name: Run Snyk to check for vulnerabilities | ||
continue-on-error: true | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
run: snyk test --all-projects --severity-threshold=high --sarif-file-output=snyk.sarif | ||
- name: Upload result to GitHub Code Scanning | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: snyk.sarif |