BTDWithChangeSNTask #17
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
name: BTDWithChangeSNTask | |
on: | |
# push: | |
# branches: ['master'] | |
# pull_request: | |
# branches: ['master'] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup JDK 11 for Sonar Cloud | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
architecture: 'x64' | |
- name: Maven Build | |
run: mvn clean install -DskipTests=true | |
- name: Sonar Cloud Analysis | |
if: success() # always() failure() success() | |
run: > | |
mvn -B verify -DskipTests sonar:sonar | |
-Dsonar.projectKey=$SONAR_PROJECT_KEY | |
-Dsonar.organization=$SONAR_ORG_KEY | |
-Dsonar.host.url=$SONAR_URL | |
-Dsonar.login=$SONAR_TOKEN | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHP_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} | |
SONAR_URL: ${{ secrets.SONAR_URL }} | |
SONAR_ORG_KEY: ${{ secrets.SONAR_ORG_KEY }} | |
- name: ServiceNow DevOps Sonar Scan Results | |
uses: ServiceNow/[email protected] | |
with: | |
devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} | |
devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} | |
instance-url: ${{ secrets.SN_INSTANCE_URL }} | |
tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} | |
job-name: "Build" | |
context-github: ${{ toJSON(github) }} | |
sonar-host-url: ${{ secrets.SONAR_URL }} | |
sonar-project-key: ${{ secrets.SONAR_PROJECT_KEY }} | |
- name: Run JUnit Tests | |
run: mvn test -Dmaven.test.failure.ignore=true surefire-report:report | |
- name: ServiceNow DevOps Unit Test Results | |
uses: ServiceNow/[email protected] | |
with: | |
devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} | |
devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} | |
instance-url: ${{ secrets.SN_INSTANCE_URL }} | |
tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} | |
context-github: ${{ toJSON(github) }} | |
job-name: "Build" | |
xml-report-filename: target/surefire-reports/testng-results.xml | |
securityTest: | |
name: SecurityTest | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: | |
ServiceNow DevOps Security Results | |
# You may pin to the exact commit or the version. | |
# uses: ServiceNow/servicenow-devops-security-result@26f3416768ffd3991f1a14c0304ba03075724929 | |
uses: ServiceNow/[email protected] | |
with: | |
# ServiceNow Instance URL | |
instance-url: ${{ secrets.SN_INSTANCE_URL }} | |
devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} | |
devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} | |
# Github Context | |
context-github: ${{ toJSON(github) }} | |
# Display Name of the Job | |
job-name: "SecurityTest" | |
# Security Results Attributes: For more information on defining the security attributes, View full Marketplace listing link above | |
security-result-attributes: '{"scanner": "Veracode", "applicationName": "PetStoreAPI-Github", "securityToolId" : "3d3672af879c02108cb0caa5cebb3553"}' | |
# Orchestration Tool Id | |
tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} | |
integrationTest: | |
needs: securityTest | |
name: Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Register Artifact | |
uses: ServiceNow/[email protected] | |
with: | |
devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} | |
devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} | |
instance-url: ${{ secrets.SN_INSTANCE_URL }} | |
tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} | |
context-github: ${{ toJSON(github) }} | |
job-name: "Integration Tests" | |
artifacts: ' [{"name": "com:autoclaim","version": "1.${{ github.run_number }}","semanticVersion": "1.${{ github.run_number }}.0","repositoryName": "${{ github.repository }}"}]' | |
- name: Register Package | |
uses: ServiceNow/[email protected] | |
with: | |
devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} | |
devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} | |
instance-url: ${{ secrets.SN_INSTANCE_URL }} | |
tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} | |
context-github: ${{ toJSON(github) }} | |
job-name: "Integration Tests" | |
artifacts: ' [{"name": "com:autoclaim","version": "1.${{ github.run_number }}","semanticVersion": "1.${{ github.run_number }}.0","repositoryName": "${{ github.repository }}"}]' | |
package-name: "autoclaim.war" | |
# deploy: | |
# needs: integrationTest | |
# name: Deploy | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Custom Change | |
# uses: ServiceNow/[email protected] | |
# with: | |
# devops-integration-user-name: ${{ secrets.SN_DEVOPS_USER }} | |
# devops-integration-user-password: ${{ secrets.SN_DEVOPS_PASSWORD }} | |
# instance-url: ${{ secrets.SN_INSTANCE_URL }} | |
# tool-id: ${{ secrets.SN_ORCHESTRATION_TOOL_ID }} | |
# context-github: ${{ toJSON(github) }} | |
# job-name: "Deploy" | |
# change-request: '{"setCloseCode":"true","attributes":{"short_description":"Automated Software Deployment","description":"Automated Software Deployment.","assignment_group":"a715cd759f2002002920bde8132e7018"}}' | |
# interval: "100" | |
# timeout: "3600" | |
# - name: Run deployment scripts | |
# run: echo Completed Deployment. |