Skip to content

Commit

Permalink
Add automatic testing (#10)
Browse files Browse the repository at this point in the history
* Add automatic testing

closes #11
closes #9
  • Loading branch information
joergi committed Jan 20, 2023
1 parent 535646a commit 286ffdf
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 22 deletions.
81 changes: 61 additions & 20 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,70 +16,111 @@ jobs:
powershell:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3.0.2
- uses: pCYSl5EDgo/cat@master
id: read_recent
with:
path: regular-issues.txt
- run: |
echo "ISSUE_NUMBER=${{ steps.read_recent.outputs.text }}" >> $GITHUB_ENV
echo "ISSUE_MINUS_ONE=$((${{ steps.read_recent.outputs.text }}-1))" >> $GITHUB_ENV
echo "ISSUE_MINUS_FIVE=$((${{ steps.read_recent.outputs.text }}-5))" >> $GITHUB_ENV
echo "ISSUE_MINUS_SIX=$((${{ steps.read_recent.outputs.text }}-6))" >> $GITHUB_ENV
shell: bash
- name: Download Issues With start limit
id: normalIssuesWithStartLimit
shell: pwsh
run: ./helloworld-downloader.ps1 -f 13
run: ./helloworld-downloader.ps1 -f ${{ env.ISSUE_MINUS_ONE }}
- name: Download Issues With end limit
id: normalIssuesWithEndLimit
shell: pwsh
run: ./helloworld-downloader.ps1 -l 3
run: ./helloworld-downloader.ps1 -l 2
- name: Download Issues with start and end limit
id: normalIssuesWithRange
shell: pwsh
run: ./helloworld-downloader.ps1 -f 5 -l 6
# https://github.com/marketplace/actions/file-existence
run: ./helloworld-downloader.ps1 -f ${{ env.ISSUE_MINUS_SIX }} -l ${{ env.ISSUE_MINUS_FIVE }}
- name: lslah
run: Get-ChildItem issues/
- name: "Check file existence Windows"
id: check_files
uses: andstor/file-existence-action@v1
uses: andstor/file-existence-action@v2.0.0
with:
files: "issues/hello-world-issue-3.pdf, issues/hello-world-issue-6.pdf, issues/hello-world-issue-14.pdf"
files: "issues/hello-world-issue-1.pdf, issues/hello-world-issue-2.pdf, issues/hello-world-issue-${{ env.ISSUE_MINUS_SIX }}.pdf, issues/hello-world-issue-${{ env.ISSUE_MINUS_FIVE }}.pdf, issues/hello-world-issue-${{ env.ISSUE_MINUS_ONE }}.pdf, issues/hello-world-issue-${{ env.ISSUE_NUMBER }}.pdf"
allow_failure: false
- name: File exists
if: steps.check_files.outputs.files_exists == 'false'
run: exit 1
bash-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3.0.2
- uses: pCYSl5EDgo/cat@master
id: read_recent
with:
path: regular-issues.txt
- run: |
echo "ISSUE_NUMBER=${{ steps.read_recent.outputs.text }}" >> $GITHUB_ENV
echo "ISSUE_MINUS_ONE=$((${{ steps.read_recent.outputs.text }}-1))" >> $GITHUB_ENV
echo "ISSUE_MINUS_FIVE=$((${{ steps.read_recent.outputs.text }}-5))" >> $GITHUB_ENV
echo "ISSUE_MINUS_SIX=$((${{ steps.read_recent.outputs.text }}-6))" >> $GITHUB_ENV
- name: Download Issues with end limit
id: normalIssuesWithLimit
run: bash ./helloworld-downloader.sh -l 3 && [[ -f issues/HelloWorld01.pdf ]]
id: normalIssuesWithEndLimit
run: bash ./helloworld-downloader.sh -l 2
- name: Download Issues with start limit
id: normalIssuesWithStartLimit
run: bash ./helloworld-downloader.sh -f ${{ env.ISSUE_MINUS_ONE }}

- name: Download Issues with start and end limit
id: normalIssuesWithRange
run: bash ./helloworld-downloader.sh -f 13 -l 14
run: bash ./helloworld-downloader.sh -f ${{ env.ISSUE_MINUS_SIX }} -l ${{ env.ISSUE_MINUS_FIVE }}
- name: lslah
run: ls -lah issues/
- name: "Check file existence Linux"
id: check_files
uses: andstor/file-existence-action@v1
uses: andstor/file-existence-action@v2.0.0
with:
files: "issues/HelloWorld01.pdf, issues/HelloWorld_14_digital.pdf"
files: "issues/HelloWorld01.pdf, issues/HelloWorld02.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_ONE }}.pdf, issues/HelloWorld${{ env.ISSUE_NUMBER }}.pdf"
# that should be the normal one, but #13 and #14 are named wrong: HW_13_Digital_Edition_V3.pdf + HelloWorld_14_digital.pdf
# files: "issues/HelloWorld01.pdf, issues/HelloWorld02.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_SIX }}.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_FIVE }}.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_ONE }}.pdf, issues/HelloWorld${{ env.ISSUE_NUMBER }}.pdf"
allow_failure: false
- name: File exists
if: steps.check_files.outputs.files_exists == 'false'
run: exit 1
bash-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3.0.2
- uses: pCYSl5EDgo/cat@master
id: read_recent
with:
path: regular-issues.txt
- run: |
echo "ISSUE_NUMBER=${{ steps.read_recent.outputs.text }}" >> $GITHUB_ENV
echo "ISSUE_MINUS_ONE=$((${{ steps.read_recent.outputs.text }}-1))" >> $GITHUB_ENV
echo "ISSUE_MINUS_FIVE=$((${{ steps.read_recent.outputs.text }}-5))" >> $GITHUB_ENV
echo "ISSUE_MINUS_SIX=$((${{ steps.read_recent.outputs.text }}-6))" >> $GITHUB_ENV
- name: Download Issues with start limit
id: normalIssuesWithStartLimit
run: bash ./helloworld-downloader.sh -f 13
run: bash ./helloworld-downloader.sh -f ${{ env.ISSUE_MINUS_ONE }}
- name: Download Issues with end limit
id: normalIssuesWithEndLimit
run: bash ./helloworld-downloader.sh -l 3
run: bash ./helloworld-downloader.sh -l 2
- name: Download Issues with start and end limit
id: normalIssuesWithRange
run: bash ./helloworld-downloader.sh -f 5 -l 6
run: bash ./helloworld-downloader.sh -f ${{ env.ISSUE_MINUS_SIX }} -l ${{ env.ISSUE_MINUS_FIVE }}
- name: lsah
id: lslah
run: ls -lah issues/
# https://github.com/marketplace/actions/file-existence
- name: "Check file existence Mac"
id: check_files
uses: andstor/file-existence-action@v1
uses: andstor/file-existence-action@v2.0.0
with:
files: "issues/HelloWorld01.pdf, issues/HelloWorld06.pdf, issues/HelloWorld_14_digital.pdf"
files: "issues/HelloWorld01.pdf, issues/HelloWorld02.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_ONE }}.pdf, issues/HelloWorld${{ env.ISSUE_NUMBER }}.pdf"
# that should be the normal one, but #13 and #14 are named wrong: HW_13_Digital_Edition_V3.pdf + HelloWorld_14_digital.pdf
# files: "issues/HelloWorld01.pdf, issues/HelloWorld02.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_SIX }}.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_FIVE }}.pdf, issues/HelloWorld${{ env.ISSUE_MINUS_ONE }}.pdf, issues/HelloWorld${{ env.ISSUE_NUMBER }}.pdf"
allow_failure: false
- name: File exists
if: steps.check_files.outputs.files_exists == 'false'
Expand Down
2 changes: 1 addition & 1 deletion helloworld-downloader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ recentIssue=$(cat "$file");
# workaround for a known limitation in bash 3.x: http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00018.html
# stackoverflow: https://stackoverflow.com/questions/32596123/why-source-command-doesnt-work-with-process-substitution-in-bash-3-2/32596626#32596626
# shellcheck disable=SC1091
source /dev/stdin <<<"$(curl -s https://raw.githubusercontent.com/joergi/downloader/0.3.0/linux_mac/downloader.sh)" "$downloadUrl" "$OUTDIR" "$recentIssue" "$@"
source /dev/stdin <<<"$(curl -s https://raw.githubusercontent.com/joergi/downloader/0.4.3/linux_mac/downloader.sh)" "$downloadUrl" "$OUTDIR" "$recentIssue" "$@"

exit 0
2 changes: 1 addition & 1 deletion regular-issues.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
19

0 comments on commit 286ffdf

Please sign in to comment.