Skip to content

Test pipeline

Test pipeline #11

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'
UBUNTU_VERSION: 'ubuntu-22.04'
jobs:
build:
runs-on: ${{ env.UBUNTU_VERSION }}

Check failure on line 19 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Continuous Integration Build Pipeline

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 19, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: env.UBUNTU_VERSION .github/workflows/build.yml (Line: 42, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: 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: 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