Skip to content

OJ-2824: Empty stack buckets before deleting stacks #378

OJ-2824: Empty stack buckets before deleting stacks

OJ-2824: Empty stack buckets before deleting stacks #378

name: Print file to step summary test
on: pull_request
permissions: {}
concurrency:
group: test-print-file-to-step-summary-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
run-tests:
name: Test action
runs-on: ubuntu-latest
env:
REPORT_FILE_NAME: test-result.txt
steps:
- name: Pull repository
uses: actions/checkout@v4
- name: Write stub report
env:
REPORT_FILE: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
run: echo "Stub result" >> "$REPORT_FILE"
- name: Do not fail on missing report
uses: ./report-step-result/print-file
with:
file-path: missing.report
fail-if-report-missing: false
- name: Fail on missing report
id: fail-on-missing-report
continue-on-error: true
uses: ./report-step-result/print-file
with:
file-path: missing.report
fail-if-report-missing: true
- name: Check error returned on missing report
if: ${{ steps.fail-on-missing-report.outcome != 'failure' }}
run: |
echo "::error::Error status not returned on missing report"
exit 1
- name: Report result
uses: ./report-step-result/print-file
with:
file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
output-file-path: ${{ runner.temp }}/report.txt
quiet: false
- name: Check result reported
env:
OUTPUT_FILE: ${{ runner.temp }}/report.txt
EXPECTED_FILE: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
run: diff "$OUTPUT_FILE" "$EXPECTED_FILE"
- name: Do not append a file to itself
uses: ./report-step-result/print-file
with:
file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
output-file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
- name: Check file not appended to itself
env:
OUTPUT_FILE: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
EXPECTED_FILE: ${{ runner.temp }}/report.txt
run: diff "$OUTPUT_FILE" "$EXPECTED_FILE"
- name: Accumulate results
uses: ./report-step-result/print-file
with:
file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
output-file-path: ${{ runner.temp }}/report.txt
- name: Check result accumulated
env:
OUTPUT_FILE: ${{ runner.temp }}/report.txt
run: |
diff "$OUTPUT_FILE" - << 'EOF'
Stub result
Stub result
EOF
- name: Include title
uses: ./report-step-result/print-file
with:
file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
output-file-path: ${{ runner.temp }}/report-with-title.txt
title: Report title
- name: Check title included
env:
OUTPUT_FILE: ${{ runner.temp }}/report-with-title.txt
run: |
diff "$OUTPUT_FILE" - << 'EOF'
**Report title**
Stub result
EOF
- name: Use code block
uses: ./report-step-result/print-file
with:
file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
output-file-path: ${{ runner.temp }}/report-code-block.txt
code-block: true
- name: Check code block used
env:
OUTPUT_FILE: ${{ runner.temp }}/report-code-block.txt
run: |
diff "$OUTPUT_FILE" - << 'EOF'
```
Stub result
```
EOF
- name: Use syntax highlighting
uses: ./report-step-result/print-file
with:
file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
output-file-path: ${{ runner.temp }}/report-syntax-highlight.txt
language: shell
- name: Check syntax highlighting used
env:
OUTPUT_FILE: ${{ runner.temp }}/report-syntax-highlight.txt
run: |
diff "$OUTPUT_FILE" - << 'EOF'
```shell
Stub result
```
EOF
- name: Use all elements
uses: ./report-step-result/print-file
with:
file-path: ${{ runner.temp }}/${{ env.REPORT_FILE_NAME }}
output-file-path: ${{ runner.temp }}/report-all-elements.txt
title: Report title
language: shell
- name: Check all elements used
env:
OUTPUT_FILE: ${{ runner.temp }}/report-all-elements.txt
run: |
diff "$OUTPUT_FILE" - << 'EOF'
**Report title**
```shell
Stub result
```
EOF
- name: Read from standard input
env:
TITLE: Pipe report
LANGUAGE: bash
REPORT: ./scripts/report-step-result/print-file.sh
run: |
cat << 'EOF' > expected_file
**Pipe report**
```bash
Standard input
```
EOF
$REPORT <<< "Standard input" | diff expected_file -