updating formatting

This commit is contained in:
Bhavin Patel
2024-07-08 15:10:48 -07:00
parent d996a8186f
commit a42b0c7036
2 changed files with 11 additions and 12 deletions
+5 -4
View File
@@ -5,8 +5,9 @@ echo "Extracted total_fail: [$total_fail]"
# Check if total_fail is a valid integer and greater than one
if [[ "$total_fail" =~ ^[0-9]+$ ]] && [ "$total_fail" -gt 1 ]; then
echo "CI Failure: There are failed tests."
echo -e "Name | Status | Test Type"
echo -e "---- | ------ | ---------"
# Adjust the column widths here
printf "%-80s | %-6s | %-10s\n" "Name" "Status" "Test Type"
printf "%-80s | %-6s | %-10s\n" "----" "------" "---------"
# Loop through each item in tested_detections and print required fields with color only for unit testing
yq e '.tested_detections[] | .name as $name | .tests[] | select(.test_type == "unit") | "\($name) | \(.success) | \(.test_type)"' test_results/summary.yml | while IFS='|' read -r name status test_type; do
@@ -15,9 +16,9 @@ if [[ "$total_fail" =~ ^[0-9]+$ ]] && [ "$total_fail" -gt 1 ]; then
test_type=$(echo $test_type | xargs) # Trim whitespace
if [ "$status" == "true" ]; then
echo -e "${name} | \033[32mPASS\033[0m | ${test_type}"
printf "%-80s | \033[32m%-6s\033[0m | %-10s\n" "$name" "PASS" "$test_type"
else
echo -e "${name} | \033[31mFAIL\033[0m | ${test_type}"
printf "%-80s | \033[31m%-6s\033[0m | %-10s\n" "$name" "FAIL" "$test_type"
fi
done
+6 -8
View File
@@ -26,8 +26,6 @@ jobs:
- name: Install Python Dependencies
run: |
# python3.11 -m venv .venv
# source .venv/bin/activate
pip install contentctl
git clone --depth=1 --single-branch --branch=master https://github.com/redcanaryco/atomic-red-team.git
@@ -37,19 +35,19 @@ jobs:
# source .venv/bin/activate
git checkout ${GITHUB_REF#refs/heads/}
echo "The target branch for this PR is ${{ github.base_ref }}"
contentctl test --disable-tqdm --post-test-behavior never_pause mode:changes --mode.target-branch ${{ github.base_ref }}
mkdir artifacts
contentctl test --disable-tqdm --no-enable-integration-testing --post-test-behavior never_pause mode:changes --mode.target-branch ${{ github.base_ref }}
mkdir test_results
# cp summary.yml test_results/
cp test_results/summary.yml artifacts/
cp test_results/summary.yml artifacts/
continue-on-error: true
- name: store_artifacts
uses: actions/upload-artifact@v3
with:
name: content-latest
name: test_summary_results
path: |
artifacts/summary.yml
test_results/summary.yml
dist/DA-ESS-ContentUpdate-latest.tar.gz
- name: Print entire test_results/summary.yml
run: cat test_results/summary.yml
@@ -57,4 +55,4 @@ jobs:
- name: Formatted Final Report
run: |
chmod +x .github/workflows/format_test_summary.sh
./.github/workflows/format_test_summary.sh
./.github/workflows/format_test_summary.sh >> $GITHUB_STEP_SUMMARY