@@ -15,21 +15,10 @@ concurrency:
1515 cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
1616
1717jobs :
18- # copyright-check:
19- # if: github.ref != 'refs/heads/main'
20- # uses: hpe-actions/copyright/.github/workflows/copyright.yml@v2
21-
22- # secrets-scanner:
23- # uses: hpe-actions/secrets-scanner/.github/workflows/secrets-scanner.yml@v2.0.2
24- # with:
25- # config_override: ".gitleaks.toml"
2618
2719 build :
2820 runs-on : ubuntu-latest
2921 if : github.ref != 'refs/heads/main'
30- # environment:
31- # name: github-pages
32- # url: ${{ steps.deployment.outputs.page_url }}
3322 permissions :
3423 contents : write
3524 packages : read
@@ -46,46 +35,60 @@ jobs:
4635 distribution : ' temurin'
4736 - uses : gradle/actions/setup-gradle@v4
4837
49- # - name: Run tests and generate coverage report
50- # run: ./gradlew test
38+ - name : Run CodeNarc
39+ run : |
40+ ./gradlew codenarcMain codenarcTest --continue || true
5141
52- # - name: Run quality checks
53- # run: ./gradlew check
42+ - name : Upload CodeNarc Reports
43+ uses : actions/upload-artifact@v4
44+ with :
45+ name : codenarc-reports
46+ path : |
47+ build/reports/codenarc/main.xml
48+ build/reports/codenarc/main.html
49+
50+ # Install Gitleaks (latest version)
51+ - name : Install Gitleaks
52+ run : |
53+ GITLEAKS_VERSION=$(curl -s https://api.github.com/repos/gitleaks/gitleaks/releases/latest | jq -r .tag_name)
54+ curl -sL "https://github.com/gitleaks/gitleaks/releases/download/${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION#v}_linux_x64.tar.gz" -o gitleaks.tar.gz
55+ tar -xvf gitleaks.tar.gz
56+ sudo mv gitleaks /usr/local/bin/
57+
58+ # Run Gitleaks scan
59+ - name : Run Gitleaks Scan
60+ run : |
61+ gitleaks detect \
62+ --source . \
63+ --report-format json \
64+ --no-banner \
65+ --report-path gitleaks-report.json \
66+ --verbose
67+ continue-on-error : true
68+
69+ # upload report as artifact
70+ - name : Upload Gitleaks Report
71+ if : always()
72+ uses : actions/upload-artifact@v4
73+ with :
74+ name : gitleaks-report
75+ path : gitleaks-report.json
76+ # Fail workflow if leaks were found
77+ - name : Fail if leaks detected
78+ if : success() # only run this after previous steps
79+ run : |
80+ if grep -q '"StartLine":' gitleaks-report.json; then
81+ echo "Gitleaks found secrets! Failing the workflow."
82+ exit 1
83+ fi
5484
5585 - name : Build and assemble the project artifacts
5686 run : ./gradlew build
5787
58- # - name: Run functional tests on simulated environment
59- # run: ./gradlew functionalTest --tests runners.CucumberTestSuite
60-
61- # - name: Create test reports index page
62- # run: |
63- # echo '<html><body>
64- # <h1>Reports</h1>
65- # <ul>
66- # <li><a href="tests/test">Test Results</a></li>
67- # <li><a href="tests/cucumberFunctionalTest">Functional Test Results</a></li>
68- # <li><a href="jacoco/test/html">Coverage Report</a></li>
69- # <li><a href="codenarc/main.html">Main CodeNarc Report</a></li>
70- # </ul>
71- # </body></html>' > build/reports/index.html
72-
73- # - name: Upload test reports as artifact
74- # uses: actions/upload-pages-artifact@v3
75- # with:
76- # path: build/reports
77-
78- # - name: Deploy test reports to GitHub Pages
79- # id: deployment
80- # uses: actions/deploy-pages@v4
81-
82- # - name: Verify minimum test coverage
83- # run: ./gradlew jacocoTestCoverageVerification
84-
85-
8688 publish-to-artifactory :
87- if : github.ref == 'refs/heads/main'
89+ # if: github.ref == 'refs/heads/main'
8890 runs-on : ubuntu-latest
91+ needs : build
8992 permissions :
9093 contents : read
9194 steps :
9699 java-version : ' 11'
97100 distribution : ' temurin'
98101
102+ - name : Install JFrog CLI v1.54.1
103+ run : |
104+ JFROG_VERSION=1.54.1
105+ curl -fL "https://releases.jfrog.io/artifactory/jfrog-cli/v1/${JFROG_VERSION}/jfrog-cli-linux-amd64/jfrog" -o jfrog
106+ chmod +x jfrog
107+ sudo mv jfrog /usr/local/bin/
108+ jfrog --version
109+
99110 - name : Build with Gradle
100- run : ./gradlew artifactoryPublish
101111 env :
102- ARTIFACTORY_USER : ' ci-token-morpheus'
103- # Secret defined at https://github.com/gomorpheus/morpheus-scvmm-plugin/settings/secrets/actions
112+ ARTIFACTORY_USER : ${{ secrets.CI_USER_MORPHEUS }}
104113 ARTIFACTORY_PASSWORD : ${{ secrets.CI_TOKEN_MORPHEUS }}
114+ ARTIFACTORY_URL : ${{ secrets.ARTIFACTORY_URL }}
115+ run : |
116+ ./gradlew --version
117+ ./gradlew buildEnvironment | grep artifactory
118+ ./gradlew tasks | grep artifactory
119+ ./gradlew uploadToArtifactory --stacktrace --info --debug
120+
121+ publish-test-summary :
122+ runs-on : ubuntu-latest
123+ needs : build
124+ permissions :
125+ contents : read
126+ steps :
127+ - uses : actions/checkout@v4
128+
129+ - uses : actions/setup-java@v4
130+ with :
131+ java-version : ' 11'
132+ distribution : ' temurin'
133+ - name : Summarize Test Results
134+ run : |
135+ echo "### Test Summary" | tee -a $GITHUB_STEP_SUMMARY
136+ echo '```' | tee -a $GITHUB_STEP_SUMMARY
137+ ./gradlew testSummary --console=plain -Dorg.gradle.logging.level=quiet | sed 's/\x1b\[[0-9;]*m//g' | tee -a $GITHUB_STEP_SUMMARY
138+ echo '```' | tee -a $GITHUB_STEP_SUMMARY
139+ env :
140+ TERM : dumb
0 commit comments