Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mre committed Apr 25, 2024
1 parent 4c4e89b commit 25d6973
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
33 changes: 28 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
CUSTOM_OUTPUT_RELATIVE_PATH: lychee/custom_output.md
CUSTOM_OUTPUT_ABSOLUTE_PATH: /tmp/report.md
CUSTOM_OUTPUT_DUMP_PATH: /tmp/dump.md

jobs:
lychee-action:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
with:
output: "${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}"
debug: true

- name: test custom output relative path - validation
run: |
echo "Checking custom output file at ${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}"
Expand All @@ -68,13 +68,13 @@ jobs:
echo "Found. Contents:"
cat "${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}"
fi
- name: test custom output absolute path - creation
uses: ./
with:
output: "${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}"
debug: true

- name: test custom output absolute path - validation
run: |
echo "Checking custom output file at ${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}"
Expand All @@ -92,7 +92,7 @@ jobs:
args: --dump './**/*.md' './**/*.html' './**/*.rst'
output: "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}"
debug: true

- name: test dump with custom output path - validation
run: |
echo "Checking dump output file at ${{ env.CUSTOM_OUTPUT_DUMP_PATH }}"
Expand All @@ -104,6 +104,29 @@ jobs:
cat "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}"
fi
- name: test failIfEmpty - no links in input should fail the pipeline
id: fail_if_empty_test
uses: ./
with:
args: --verbose --no-progress fixtures/empty.md
debug: true
continue-on-error: true

# Explictly check the exit code of the previous step
# as it's expected to fail
- name: Check failIfEmpty
if: steps.fail_if_empty_test.outcome != 'failure'
run: |
echo "FailIfEmpty should have failed because no links were found."
exit 1
- name: test disable failIfEmpty - it's okay if no links are found
id: fail_if_empty_test_disabled
uses: ./
with:
args: --verbose --no-progress fixtures/empty.md
failIfEmpty: false

- name: Install jq
run: sudo apt-get install jq

Expand Down
1 change: 1 addition & 0 deletions fixtures/empty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file contains no links. Used for checking `failIfEmpty` flag.

0 comments on commit 25d6973

Please sign in to comment.