Skip to content

Commit

Permalink
chore: make debug log file names unique
Browse files Browse the repository at this point in the history
  • Loading branch information
ladamesny committed Dec 9, 2024
1 parent 523e700 commit 9698563
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/actions/tests/run-e2e-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,30 +109,43 @@ runs:
if: always()
shell: bash
run: |
# Determine test phase based on keyword
if [[ "${{ inputs.keyword }}" == "test_get_status or test_get_params" ]]; then
TEST_PHASE="smoke"
elif [[ "${{ inputs.tests }}" == "postmerge" ]]; then
if [[ "${{ inputs.mc_epoch }}" == "3" ]]; then
TEST_PHASE="postmerge-final"
else
TEST_PHASE="postmerge-epoch${{ inputs.mc_epoch }}"
fi
else
TEST_PHASE="premerge"
fi
echo "TEST_PHASE=${TEST_PHASE}" >> $GITHUB_ENV
if [[ "${{ inputs.local-environment }}" == "true" ]]; then
echo "Copy debug log from docker container"
# Create directory if it doesn't exist
mkdir -p E2E-tests
# Copy from the container's E2E-tests path
docker cp tests:/e2e-tests/debug.log E2E-tests/debug.log || docker cp tests:/E2E-tests/debug.log E2E-tests/debug.log
docker cp tests:/e2e-tests/debug.log E2E-tests/debug_${TEST_PHASE}.log || docker cp tests:/E2E-tests/debug.log E2E-tests/debug_${TEST_PHASE}.log
cd E2E-tests
else
cd e2e-tests
fi
# Process the log file
awk '{print strftime("[%Y-%m-%d %H:%M:%S]"), $0}' debug.log > debug_with_timestamps.log
awk '{print strftime("[%Y-%m-%d %H:%M:%S]"), $0}' debug_${TEST_PHASE}.log > debug_with_timestamps.log
nl -ba -s ' ' -w 8 debug_with_timestamps.log > debug_with_timestamps_and_line_numbers.log
mv debug_with_timestamps_and_line_numbers.log debug.log
mv debug_with_timestamps_and_line_numbers.log debug_${TEST_PHASE}.log
- name: Archive Debug Log
if: always()
uses: actions/upload-artifact@v4
with:
name: debug_log_${{ steps.run-tests.outcome }}
name: debug_log_${{ env.TEST_PHASE }}
retention-days: 15
overwrite: true
path: E2E-tests/debug.log
path: E2E-tests/debug_${{ env.TEST_PHASE }}.log
if-no-files-found: error

- name: Copy test results
Expand Down

0 comments on commit 9698563

Please sign in to comment.