-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
22706 configure gha and it for cli (#25674)
- Loading branch information
Showing
45 changed files
with
923 additions
and
190 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: CLI tests | ||
on: | ||
pull_request: | ||
paths: | ||
- 'tools/dotcms-cli/**' | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
jobs: | ||
cli_tests: | ||
name: CLI tests | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tests_results_status: ${{ steps.run-cli-tests.outputs.status }} | ||
tests_results_report_url: ${{ steps.publish-test-results.outputs.tests_report_url }} | ||
tests_results_log_url: ${{ steps.publish-test-results.outputs.test_logs_url }} | ||
steps: | ||
- id: checkout-core | ||
name: Checkout core | ||
uses: actions/checkout@v3 | ||
- id: prepare-license | ||
name: Prepare license | ||
working-directory: ./tools/dotcms-cli/ | ||
env: | ||
DOTCMS_LICENSE_KEY: ${{ secrets.DOTCMS_LICENSE }} | ||
run: | | ||
DOTCMS_LICENSE_PATH=${GITHUB_WORKSPACE}/tools/dotcms-cli/license | ||
mkdir -p ${DOTCMS_LICENSE_PATH} | ||
echo "${DOTCMS_LICENSE_KEY}" > ${DOTCMS_LICENSE_PATH}/license.dat | ||
echo "DOTCMS_LICENSE_FILE=${DOTCMS_LICENSE_PATH}/license.dat" >> "$GITHUB_ENV" | ||
- id: run-cli-tests | ||
name: Run cli tests | ||
working-directory: ./tools/dotcms-cli/ | ||
run: | | ||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
BUILD_ID="${{ github.head_ref }}" | ||
else | ||
BUILD_ID=$(basename "${{ github.ref }}") | ||
fi | ||
./mvnw clean verify | ||
FAILURES=$(find target -name TEST-*.xml | xargs grep '<failure' | wc -l) | ||
if [ $FAILURES -eq 0 ]; then | ||
OUTPUT_STATUS="PASSED" | ||
else | ||
OUTPUT_STATUS="FAILED" | ||
fi | ||
echo "status=$OUTPUT_STATUS" >> $GITHUB_OUTPUT | ||
./mvnw surefire-report:report-only surefire-report:failsafe-report-only | ||
DOT_CLI_PATH=${{ github.workspace }}/tools/dotcms-cli | ||
RESULTS_PATH=${DOT_CLI_PATH}/target/test-results | ||
XML_REPORTS_PATH=${RESULTS_PATH}/xml-reports | ||
HTML_REPORTS_PATH=${RESULTS_PATH}/html-reports | ||
POM_FILE=${DOT_CLI_PATH}/pom.xml | ||
CICD_RES_PATH=${{ github.workspace }}/cicd/resources | ||
INDEX_FILE=${HTML_REPORTS_PATH}/index.html | ||
mkdir -p ${HTML_REPORTS_PATH} | ||
touch ${INDEX_FILE} | ||
cat ${CICD_RES_PATH}/cli/cli-results-header.html >> ${INDEX_FILE} | ||
MODULES=$(grep "<module>" $POM_FILE | sed 's/<module>//' | sed 's/<\/module>//') | ||
for module in $MODULES | ||
do | ||
mkdir -p ${XML_REPORTS_PATH}/${module} | ||
cp -r ${module}/target/surefire-reports ${XML_REPORTS_PATH}/${module} | ||
cp -r ${module}/target/failsafe-reports ${XML_REPORTS_PATH}/${module} | ||
mkdir -p ${HTML_REPORTS_PATH}/${module} | ||
cp -r ${module}/target/site/* ${HTML_REPORTS_PATH}/${module} | ||
for report in surefire failsafe | ||
do | ||
echo "<tr><td>${module}</td><td><a href=\"${module}/site/${report}-report.html\">${report} report</a></td></tr>" >> ${INDEX_FILE} | ||
done | ||
done | ||
cat ${CICD_RES_PATH}/cli/cli-results-footer.html >> ${INDEX_FILE} | ||
echo "BUILD_ID=${BUILD_ID}" >> "$GITHUB_ENV" | ||
echo "results_location=${XML_REPORTS_PATH}" >> "$GITHUB_OUTPUT" | ||
echo "results_report_location=${HTML_REPORTS_PATH}" >> "$GITHUB_OUTPUT" | ||
tree ${RESULTS_PATH} | ||
- id: publish-test-results | ||
name: Github publish tests results | ||
uses: ./.github/actions/publish-test-results | ||
with: | ||
build_id: ${{ env.BUILD_ID }} | ||
build_hash: ${{ env.BUILD_HASH }} | ||
test_type: cli | ||
pull_request: ${{ github.event.number }} # optional in case the tests are triggered by a PR | ||
tests_results_status: ${{ steps.run-cli-tests.outputs.status }} # tests results status, optional | ||
tests_results_location: ${{ steps.run-cli-tests.outputs.results_location }} # tests results location, optional, most of the time this made up of a bunch of XML files, optional | ||
tests_results_report_location: ${{ steps.run-cli-tests.outputs.results_report_location }} # actual reports made from XML files, probably in HTML format | ||
tests_results_repo: tools-test-results | ||
cicd_github_token: ${{ secrets.CICD_GITHUB_TOKEN }} | ||
include: RESULTS | ||
|
||
- id: github-status | ||
name: Send Github Status | ||
uses: ./.github/actions/github-status | ||
with: | ||
test_type: cli | ||
test_results_status: ${{ steps.run-cli-tests.outputs.status }} | ||
pull_request: ${{ github.event.number }} | ||
github_user: ${{ env.GITHUB_USER }} | ||
cicd_github_token: ${{ secrets.CICD_GITHUB_TOKEN }} | ||
tests_report_url: ${{ steps.publish-test-results.outputs.tests_report_url }} | ||
if: (success() || failure()) && steps.publish-test-results.outputs.tests_report_url != '' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
</tbody> | ||
</table> | ||
</div> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>CLI Reports</title> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,700&display=swap" /> | ||
<link rel="stylesheet" href="https://dotcms.com/DOTSASS/application/themes/dotcms/css/main.css?v=05-21-2020" /> | ||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> | ||
<meta http-equiv="Pragma" content="no-cache" /> | ||
<meta http-equiv="Expires" content="0" /> | ||
</head> | ||
<body> | ||
<div> | ||
<h2>CLI Reports</h2> | ||
<table style="width: 60%;" class="table table-bordered mb-5"> | ||
<tbody> | ||
<tr><th>Module</th><th>Report</th></tr> |
Oops, something went wrong.