From eede3fab49d621673581fb8e80b0484d1093892a Mon Sep 17 00:00:00 2001 From: Matthias Endler Date: Fri, 5 Jan 2024 14:15:03 +0100 Subject: [PATCH] Add integration tests for absolute output path and `--dump` --- .github/workflows/test.yml | 51 ++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f64cb3..d25dc5c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,9 @@ on: - pull_request env: - CUSTOM_OUTPUT_PATH: lychee/custom_output.md + 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: @@ -50,21 +52,56 @@ jobs: './**/*.rst' fail: true - - name: test custom output path - creation + - name: test custom output relative path - creation uses: ./ with: - output: "${{ env.CUSTOM_OUTPUT_PATH }}" + output: "${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}" debug: true - - name: test custom output path - validation + - name: test custom output relative path - validation run: | - echo "Checking custom output file at ${{ env.CUSTOM_OUTPUT_PATH }}" - if [ ! -f "${{ env.CUSTOM_OUTPUT_PATH }}" ]; then + echo "Checking custom output file at ${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}" + if [ ! -f "${{ env.CUSTOM_OUTPUT_RELATIVE_PATH }}" ]; then echo "Not found" exit 1 else echo "Found. Contents:" - cat "${{ env.CUSTOM_OUTPUT_PATH }}" + 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 }}" + if [ ! -f "${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}" ]; then + echo "Not found" + exit 1 + else + echo "Found. Contents:" + cat "${{ env.CUSTOM_OUTPUT_ABSOLUTE_PATH }}" + fi + + - name: test dump with custom output path - creation + uses: ./ + with: + 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 }}" + if [ ! -f "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}" ]; then + echo "Not found" + exit 1 + else + echo "Found. Contents:" + cat "${{ env.CUSTOM_OUTPUT_DUMP_PATH }}" fi - name: Install jq