diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..71d84bf --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,47 @@ +name: Build code, run unit test, run SAST, SCA, DAST security scans +on: push + +jobs: + build: + runs-on: ubuntu-latest + name: Run unit tests and SAST scan on the source code + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + - name: Build with Mavencloud + run: mvn -B verify sonar:sonar -Dsonar.projectKey=javaprojectreachability -Dsonar.organization=javaprojectreachability -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + security: + runs-on: ubuntu-latest + needs: build + name: Run the SCA scan on the source code + steps: + - uses: actions/checkout@master + - name: RunSnyk to check for vulnerabilities + uses: snyk/actions/maven@master + continue-on-error: true + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + zap_scan: + runs-on: ubuntu-latest + needs: security + name: Run DAST scan on the web application + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: master + - name: ZAP Scan + uses: zaproxy/action-baseline@v0.6.1 + with: + docker_name: 'owasp/zap2docker-stable' + target: 'http://testphp.vulnweb.com/' + rules_file_name: '.zap/rules.tsv' + cmd_options: '-a'