From 6dec7992a8f85496ba404d874ea8129a65a2777b Mon Sep 17 00:00:00 2001 From: l Date: Tue, 31 Mar 2026 14:10:57 +0100 Subject: [PATCH 1/3] Add expected answers and test yaml --- .github/workflows/test-sdc-tasks.yml | 59 ++++++++++++ .gitignore | 1 + .../individual-shell-tools/awk/script-01.sh | 6 ++ .../individual-shell-tools/awk/script-02.sh | 12 +++ .../individual-shell-tools/awk/script-03.sh | 6 ++ .../individual-shell-tools/awk/script-04.sh | 3 + .../individual-shell-tools/awk/script-05.sh | 6 ++ .../awk/script-06-stretch.sh | 1 + .../individual-shell-tools/awk/script-06.sh | 0 .../awk/script-07-stretch.sh | 6 ++ .../individual-shell-tools/cat/script-01.sh | 1 + .../individual-shell-tools/cat/script-02.sh | 5 ++ .../individual-shell-tools/cat/script-03.sh | 3 + .../cat/script-04-stretch.sh | 5 ++ .../individual-shell-tools/grep/script-01.sh | 6 ++ .../individual-shell-tools/grep/script-02.sh | 9 ++ .../individual-shell-tools/grep/script-03.sh | 1 + .../individual-shell-tools/grep/script-04.sh | 10 +++ .../individual-shell-tools/grep/script-05.sh | 5 ++ .../individual-shell-tools/grep/script-06.sh | 2 + .../individual-shell-tools/grep/script-07.sh | 3 + expect/individual-shell-tools/ls/script-01.sh | 5 ++ expect/individual-shell-tools/ls/script-02.sh | 3 + expect/individual-shell-tools/ls/script-03.sh | 11 +++ expect/individual-shell-tools/ls/script-04.sh | 8 ++ .../individual-shell-tools/sed/script-01.sh | 11 +++ .../individual-shell-tools/sed/script-02.sh | 11 +++ .../individual-shell-tools/sed/script-03.sh | 6 ++ .../individual-shell-tools/sed/script-04.sh | 11 +++ .../individual-shell-tools/sed/script-05.sh | 11 +++ .../individual-shell-tools/sed/script-06.sh | 11 +++ expect/individual-shell-tools/wc/script-01.sh | 1 + expect/individual-shell-tools/wc/script-02.sh | 1 + expect/individual-shell-tools/wc/script-03.sh | 4 + expect/jq/script-01.sh | 1 + expect/jq/script-02.sh | 1 + expect/jq/script-03.sh | 2 + expect/jq/script-04.sh | 6 ++ expect/jq/script-05.sh | 6 ++ expect/jq/script-06.sh | 6 ++ expect/jq/script-07.sh | 6 ++ expect/jq/script-08.sh | 6 ++ expect/jq/script-09.sh | 6 ++ expect/jq/script-10.sh | 1 + expect/jq/script-11.sh | 1 + expect/shell-pipelines/ls-grep/script-01.sh | 11 +++ expect/shell-pipelines/ls-grep/script-02.sh | 10 +++ expect/shell-pipelines/ls-grep/script-03.sh | 7 ++ expect/shell-pipelines/ls-grep/script-04.sh | 1 + .../sort-uniq-head-tail/script-01.sh | 6 ++ .../sort-uniq-head-tail/script-02.sh | 6 ++ .../sort-uniq-head-tail/script-03.sh | 3 + .../sort-uniq-head-tail/script-04.sh | 1 + .../sort-uniq-head-tail/script-05.sh | 6 ++ .../sort-uniq-head-tail/script-06.sh | 2 + .../sort-uniq-head-tail/script-07.sh | 2 + expect/shell-pipelines/tr/script-01.sh | 11 +++ expect/shell-pipelines/tr/script-02.sh | 11 +++ test-sdc.sh | 90 +++++++++++++++++++ 59 files changed, 453 insertions(+) create mode 100644 .github/workflows/test-sdc-tasks.yml create mode 100755 expect/individual-shell-tools/awk/script-01.sh create mode 100755 expect/individual-shell-tools/awk/script-02.sh create mode 100755 expect/individual-shell-tools/awk/script-03.sh create mode 100755 expect/individual-shell-tools/awk/script-04.sh create mode 100755 expect/individual-shell-tools/awk/script-05.sh create mode 100755 expect/individual-shell-tools/awk/script-06-stretch.sh create mode 100644 expect/individual-shell-tools/awk/script-06.sh create mode 100755 expect/individual-shell-tools/awk/script-07-stretch.sh create mode 100755 expect/individual-shell-tools/cat/script-01.sh create mode 100755 expect/individual-shell-tools/cat/script-02.sh create mode 100755 expect/individual-shell-tools/cat/script-03.sh create mode 100755 expect/individual-shell-tools/cat/script-04-stretch.sh create mode 100755 expect/individual-shell-tools/grep/script-01.sh create mode 100755 expect/individual-shell-tools/grep/script-02.sh create mode 100755 expect/individual-shell-tools/grep/script-03.sh create mode 100755 expect/individual-shell-tools/grep/script-04.sh create mode 100755 expect/individual-shell-tools/grep/script-05.sh create mode 100755 expect/individual-shell-tools/grep/script-06.sh create mode 100755 expect/individual-shell-tools/grep/script-07.sh create mode 100755 expect/individual-shell-tools/ls/script-01.sh create mode 100755 expect/individual-shell-tools/ls/script-02.sh create mode 100755 expect/individual-shell-tools/ls/script-03.sh create mode 100755 expect/individual-shell-tools/ls/script-04.sh create mode 100755 expect/individual-shell-tools/sed/script-01.sh create mode 100755 expect/individual-shell-tools/sed/script-02.sh create mode 100755 expect/individual-shell-tools/sed/script-03.sh create mode 100755 expect/individual-shell-tools/sed/script-04.sh create mode 100755 expect/individual-shell-tools/sed/script-05.sh create mode 100755 expect/individual-shell-tools/sed/script-06.sh create mode 100755 expect/individual-shell-tools/wc/script-01.sh create mode 100755 expect/individual-shell-tools/wc/script-02.sh create mode 100755 expect/individual-shell-tools/wc/script-03.sh create mode 100755 expect/jq/script-01.sh create mode 100755 expect/jq/script-02.sh create mode 100755 expect/jq/script-03.sh create mode 100755 expect/jq/script-04.sh create mode 100755 expect/jq/script-05.sh create mode 100755 expect/jq/script-06.sh create mode 100755 expect/jq/script-07.sh create mode 100755 expect/jq/script-08.sh create mode 100755 expect/jq/script-09.sh create mode 100755 expect/jq/script-10.sh create mode 100755 expect/jq/script-11.sh create mode 100755 expect/shell-pipelines/ls-grep/script-01.sh create mode 100755 expect/shell-pipelines/ls-grep/script-02.sh create mode 100755 expect/shell-pipelines/ls-grep/script-03.sh create mode 100755 expect/shell-pipelines/ls-grep/script-04.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-01.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-02.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-03.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-04.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-05.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-06.sh create mode 100755 expect/shell-pipelines/sort-uniq-head-tail/script-07.sh create mode 100755 expect/shell-pipelines/tr/script-01.sh create mode 100755 expect/shell-pipelines/tr/script-02.sh create mode 100755 test-sdc.sh diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml new file mode 100644 index 000000000..30369deaf --- /dev/null +++ b/.github/workflows/test-sdc-tasks.yml @@ -0,0 +1,59 @@ +name: Test SDC Tasks + +on: + pull_request_target: + types: + - labeled + - unlabeled + - opened + - edited + - reopened + +jobs: + test_sdc_tasks: + + name: Test SDC Tasks + runs-on: ubuntu-slim + permissions: + pull-requests: write + + steps: + - name: checkout pushed PR + uses: actions/checkout@v5 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v47.0.5 + - name: test individual shell tools + if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') + run: ./test-sdc.sh individual-shell-tools + shell: bash + - name: test jq + if: contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') + run: ./test-sdc.sh jq + shell: bash + - name: test shell-pipelines + if: contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + run: ./test-sdc.sh shell-pipelines + shell: bash + - name: make output comment + if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + env: + GH_TOKEN: ${{ secrets.MY_TOKEN }} + ISSUE_URL: ${{ github.event.issue.html_url }} + run: | + gh issue comment $ISSUE_URL --body-FILE testoutput.TXT + - name: read test output + if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + id: read-test-output + run: | + echo 'testoutput<> $GITHUB_OUTPUT + cat testoutput.txt >> $GITHUB_OUTPUT + echo EOF >> $GITHUB_OUTPUT + - name: add appropriate labels + if: contains(steps.read-test-output.outputs.testoutput, 'complete!') + env: + GH_TOKEN: ${{ secrets.MY_TOKEN }} + ISSUE_URL: ${{ github.event.issue.html_url }} + run: | + gh issue edit $ISSUE_URL --add-label "Complete" + gh issue edit $ISSUE_URL --remove-label "Needs Review" diff --git a/.gitignore b/.gitignore index 3c3629e64..c4234ab74 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +testoutput.txt diff --git a/expect/individual-shell-tools/awk/script-01.sh b/expect/individual-shell-tools/awk/script-01.sh new file mode 100755 index 000000000..050f04374 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-01.sh @@ -0,0 +1,6 @@ +Ahmed +Basia +Mehmet +Leila +Piotr +Chandra diff --git a/expect/individual-shell-tools/awk/script-02.sh b/expect/individual-shell-tools/awk/script-02.sh new file mode 100755 index 000000000..44e2e83e2 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-02.sh @@ -0,0 +1,12 @@ +Ahmed London +Basia London +Mehmet Birmingham +Leila London +Piotr Glasgow +Chandra Birmingham +Ahmed London +Basia London +Mehmet Birmingham +Leila London +Piotr Glasgow +Chandra Birmingham diff --git a/expect/individual-shell-tools/awk/script-03.sh b/expect/individual-shell-tools/awk/script-03.sh new file mode 100755 index 000000000..f5d0b1f03 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-03.sh @@ -0,0 +1,6 @@ +Ahmed 1 +Basia 22 +Mehmet 3 +Leila 1 +Piotr 15 +Chandra 12 diff --git a/expect/individual-shell-tools/awk/script-04.sh b/expect/individual-shell-tools/awk/script-04.sh new file mode 100755 index 000000000..6e95a2f5c --- /dev/null +++ b/expect/individual-shell-tools/awk/script-04.sh @@ -0,0 +1,3 @@ +Ahmed 4 +Basia 6 +Leila 1 diff --git a/expect/individual-shell-tools/awk/script-05.sh b/expect/individual-shell-tools/awk/script-05.sh new file mode 100755 index 000000000..dd7e1d36c --- /dev/null +++ b/expect/individual-shell-tools/awk/script-05.sh @@ -0,0 +1,6 @@ +Ahmed 3 +Basia 3 +Mehmet 3 +Leila 1 +Piotr 5 +Chandra 2 diff --git a/expect/individual-shell-tools/awk/script-06-stretch.sh b/expect/individual-shell-tools/awk/script-06-stretch.sh new file mode 100755 index 000000000..fb1e7bc86 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-06-stretch.sh @@ -0,0 +1 @@ +54 diff --git a/expect/individual-shell-tools/awk/script-06.sh b/expect/individual-shell-tools/awk/script-06.sh new file mode 100644 index 000000000..e69de29bb diff --git a/expect/individual-shell-tools/awk/script-07-stretch.sh b/expect/individual-shell-tools/awk/script-07-stretch.sh new file mode 100755 index 000000000..33ff777a7 --- /dev/null +++ b/expect/individual-shell-tools/awk/script-07-stretch.sh @@ -0,0 +1,6 @@ +Ahmed 15 +Basia 37 +Mehmet 32 +Leila 1 +Piotr 61 +Chandra 18 diff --git a/expect/individual-shell-tools/cat/script-01.sh b/expect/individual-shell-tools/cat/script-01.sh new file mode 100755 index 000000000..ed7bf7d08 --- /dev/null +++ b/expect/individual-shell-tools/cat/script-01.sh @@ -0,0 +1 @@ +Once upon a time... diff --git a/expect/individual-shell-tools/cat/script-02.sh b/expect/individual-shell-tools/cat/script-02.sh new file mode 100755 index 000000000..769b7e08c --- /dev/null +++ b/expect/individual-shell-tools/cat/script-02.sh @@ -0,0 +1,5 @@ +Once upon a time... +There was a house made of gingerbread. +It looked delicious. +I was tempted to take a bite of it. +But this seemed like a bad idea... diff --git a/expect/individual-shell-tools/cat/script-03.sh b/expect/individual-shell-tools/cat/script-03.sh new file mode 100755 index 000000000..f97bd500a --- /dev/null +++ b/expect/individual-shell-tools/cat/script-03.sh @@ -0,0 +1,3 @@ + 1 It looked delicious. + 2 I was tempted to take a bite of it. + 3 But this seemed like a bad idea... diff --git a/expect/individual-shell-tools/cat/script-04-stretch.sh b/expect/individual-shell-tools/cat/script-04-stretch.sh new file mode 100755 index 000000000..6f35e89d2 --- /dev/null +++ b/expect/individual-shell-tools/cat/script-04-stretch.sh @@ -0,0 +1,5 @@ + 1 Once upon a time... + 2 There was a house made of gingerbread. + 3 It looked delicious. + 4 I was tempted to take a bite of it. + 5 But this seemed like a bad idea... diff --git a/expect/individual-shell-tools/grep/script-01.sh b/expect/individual-shell-tools/grep/script-01.sh new file mode 100755 index 000000000..bc96ffe9e --- /dev/null +++ b/expect/individual-shell-tools/grep/script-01.sh @@ -0,0 +1,6 @@ +Doctor: Hello +Doctor: What's wrong today? +Doctor: That sounds frustrating. When did this start? +Doctor: Say "Hi". +Doctor: You didn't say hello +Doctor: You're welcome, goodbye diff --git a/expect/individual-shell-tools/grep/script-02.sh b/expect/individual-shell-tools/grep/script-02.sh new file mode 100755 index 000000000..bad606e1e --- /dev/null +++ b/expect/individual-shell-tools/grep/script-02.sh @@ -0,0 +1,9 @@ +Doctor: Hello +Patient: Hello Doctor +Doctor: What's wrong today? +Doctor: That sounds frustrating. When did this start? +Doctor: Say "Hi". +Doctor: You didn't say hello +Doctor: You're welcome, goodbye +Patient: I went to the doctor! +Spouse: I'm glad you saw the Doctor: did they cure you? diff --git a/expect/individual-shell-tools/grep/script-03.sh b/expect/individual-shell-tools/grep/script-03.sh new file mode 100755 index 000000000..ec635144f --- /dev/null +++ b/expect/individual-shell-tools/grep/script-03.sh @@ -0,0 +1 @@ +9 diff --git a/expect/individual-shell-tools/grep/script-04.sh b/expect/individual-shell-tools/grep/script-04.sh new file mode 100755 index 000000000..5814afa2a --- /dev/null +++ b/expect/individual-shell-tools/grep/script-04.sh @@ -0,0 +1,10 @@ +Doctor: What's wrong today? +Doctor: That sounds frustrating. When did this start? +Doctor: Say "Hi". +Patient: Hi +Patient: I seem to be cured! +Doctor: You're welcome, goodbye + +Patient: I went to the doctor! +Spouse: I'm glad you saw the Doctor: did they cure you? +Patient: Yes! diff --git a/expect/individual-shell-tools/grep/script-05.sh b/expect/individual-shell-tools/grep/script-05.sh new file mode 100755 index 000000000..2ed07ed20 --- /dev/null +++ b/expect/individual-shell-tools/grep/script-05.sh @@ -0,0 +1,5 @@ +Doctor: You didn't say hello +Patient: I seem to be cured! +-- +Patient: I went to the doctor! +Spouse: I'm glad you saw the Doctor: did they cure you? diff --git a/expect/individual-shell-tools/grep/script-06.sh b/expect/individual-shell-tools/grep/script-06.sh new file mode 100755 index 000000000..87b3a4f5e --- /dev/null +++ b/expect/individual-shell-tools/grep/script-06.sh @@ -0,0 +1,2 @@ +dialogue-2.txt +dialogue.txt diff --git a/expect/individual-shell-tools/grep/script-07.sh b/expect/individual-shell-tools/grep/script-07.sh new file mode 100755 index 000000000..aed78c634 --- /dev/null +++ b/expect/individual-shell-tools/grep/script-07.sh @@ -0,0 +1,3 @@ +dialogue-2.txt:2 +dialogue-3.txt:0 +dialogue.txt:6 diff --git a/expect/individual-shell-tools/ls/script-01.sh b/expect/individual-shell-tools/ls/script-01.sh new file mode 100755 index 000000000..dd590d624 --- /dev/null +++ b/expect/individual-shell-tools/ls/script-01.sh @@ -0,0 +1,5 @@ +child-directory +script-01.sh +script-02.sh +script-03.sh +script-04.sh diff --git a/expect/individual-shell-tools/ls/script-02.sh b/expect/individual-shell-tools/ls/script-02.sh new file mode 100755 index 000000000..bfd087e6a --- /dev/null +++ b/expect/individual-shell-tools/ls/script-02.sh @@ -0,0 +1,3 @@ +helper-1.txt +helper-2.txt +helper-3.txt diff --git a/expect/individual-shell-tools/ls/script-03.sh b/expect/individual-shell-tools/ls/script-03.sh new file mode 100755 index 000000000..36acd715f --- /dev/null +++ b/expect/individual-shell-tools/ls/script-03.sh @@ -0,0 +1,11 @@ +.: +child-directory +script-01.sh +script-02.sh +script-03.sh +script-04.sh + +./child-directory: +helper-1.txt +helper-2.txt +helper-3.txt diff --git a/expect/individual-shell-tools/ls/script-04.sh b/expect/individual-shell-tools/ls/script-04.sh new file mode 100755 index 000000000..86e7570ec --- /dev/null +++ b/expect/individual-shell-tools/ls/script-04.sh @@ -0,0 +1,8 @@ +First exercise (sorted newest to oldest): +helper-3.txt +helper-1.txt +helper-2.txt +Second exercise (sorted oldest to newest): +helper-2.txt +helper-1.txt +helper-3.txt diff --git a/expect/individual-shell-tools/sed/script-01.sh b/expect/individual-shell-tools/sed/script-01.sh new file mode 100755 index 000000000..d92b03ab0 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-01.sh @@ -0,0 +1,11 @@ +ThIs Is a sample fIle for experImentIng wIth sed. + +It contaIns many lInes, and there are some thIngs you may want to do wIth each of them. + +We'll Include some score InformatIon: +37 AlIsha +15 Jacob +7 PIetro +3 Katya + +We also should remember, when we go shoppIng, to get 4 Items: oranges,cheese,bread,olIves. diff --git a/expect/individual-shell-tools/sed/script-02.sh b/expect/individual-shell-tools/sed/script-02.sh new file mode 100755 index 000000000..e326bd4ab --- /dev/null +++ b/expect/individual-shell-tools/sed/script-02.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: + Alisha + Jacob + Pietro + Katya + +We also should remember, when we go shopping, to get items: oranges,cheese,bread,olives. diff --git a/expect/individual-shell-tools/sed/script-03.sh b/expect/individual-shell-tools/sed/script-03.sh new file mode 100755 index 000000000..088b17d55 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-03.sh @@ -0,0 +1,6 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: + diff --git a/expect/individual-shell-tools/sed/script-04.sh b/expect/individual-shell-tools/sed/script-04.sh new file mode 100755 index 000000000..852fa1557 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-04.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: +37 Alisha +15 Jacob +7 Pietro +3 Katya + +We also should remember, when we go shopping, to get 4 items: oranges,cheese,bread,olives. diff --git a/expect/individual-shell-tools/sed/script-05.sh b/expect/individual-shell-tools/sed/script-05.sh new file mode 100755 index 000000000..fe4d9d105 --- /dev/null +++ b/expect/individual-shell-tools/sed/script-05.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: +Alisha 37 +Jacob 15 +Pietro 7 +Katya 3 + +We also should remember, when we go shopping, to get 4 items: oranges,cheese,bread,olives. diff --git a/expect/individual-shell-tools/sed/script-06.sh b/expect/individual-shell-tools/sed/script-06.sh new file mode 100755 index 000000000..d9f950fec --- /dev/null +++ b/expect/individual-shell-tools/sed/script-06.sh @@ -0,0 +1,11 @@ +This is a sample file for experimenting with sed. + +It contains many lines, and there are some things you may want to do with each of them. + +We'll include some score information: +37 Alisha +15 Jacob +7 Pietro +3 Katya + +We also should remember, when we go shopping, to get 4 items: oranges, cheese, bread, olives. diff --git a/expect/individual-shell-tools/wc/script-01.sh b/expect/individual-shell-tools/wc/script-01.sh new file mode 100755 index 000000000..d1ad53e8b --- /dev/null +++ b/expect/individual-shell-tools/wc/script-01.sh @@ -0,0 +1 @@ +19 ../helper-files/helper-3.txt diff --git a/expect/individual-shell-tools/wc/script-02.sh b/expect/individual-shell-tools/wc/script-02.sh new file mode 100755 index 000000000..6bd060b79 --- /dev/null +++ b/expect/individual-shell-tools/wc/script-02.sh @@ -0,0 +1 @@ +3 ../helper-files/helper-3.txt diff --git a/expect/individual-shell-tools/wc/script-03.sh b/expect/individual-shell-tools/wc/script-03.sh new file mode 100755 index 000000000..572716a44 --- /dev/null +++ b/expect/individual-shell-tools/wc/script-03.sh @@ -0,0 +1,4 @@ + 1 4 20 ../helper-files/helper-1.txt + 1 7 39 ../helper-files/helper-2.txt + 3 19 92 ../helper-files/helper-3.txt + 5 30 151 total diff --git a/expect/jq/script-01.sh b/expect/jq/script-01.sh new file mode 100755 index 000000000..e16f4ed9b --- /dev/null +++ b/expect/jq/script-01.sh @@ -0,0 +1 @@ +Selma diff --git a/expect/jq/script-02.sh b/expect/jq/script-02.sh new file mode 100755 index 000000000..18711affa --- /dev/null +++ b/expect/jq/script-02.sh @@ -0,0 +1 @@ +35 Fashion Street, London, E1 6PX diff --git a/expect/jq/script-03.sh b/expect/jq/script-03.sh new file mode 100755 index 000000000..d63f6ec74 --- /dev/null +++ b/expect/jq/script-03.sh @@ -0,0 +1,2 @@ +Selma, Software Engineer +Selma, Software Engineer diff --git a/expect/jq/script-04.sh b/expect/jq/script-04.sh new file mode 100755 index 000000000..050f04374 --- /dev/null +++ b/expect/jq/script-04.sh @@ -0,0 +1,6 @@ +Ahmed +Basia +Mehmet +Leila +Piotr +Chandra diff --git a/expect/jq/script-05.sh b/expect/jq/script-05.sh new file mode 100755 index 000000000..ee7e0feb5 --- /dev/null +++ b/expect/jq/script-05.sh @@ -0,0 +1,6 @@ +Ahmed London +Basia London +Mehmet Birmingham +Leila London +Piotr Glasgow +Chandra Birmingham diff --git a/expect/jq/script-06.sh b/expect/jq/script-06.sh new file mode 100755 index 000000000..f5d0b1f03 --- /dev/null +++ b/expect/jq/script-06.sh @@ -0,0 +1,6 @@ +Ahmed 1 +Basia 22 +Mehmet 3 +Leila 1 +Piotr 15 +Chandra 12 diff --git a/expect/jq/script-07.sh b/expect/jq/script-07.sh new file mode 100755 index 000000000..59c783f1d --- /dev/null +++ b/expect/jq/script-07.sh @@ -0,0 +1,6 @@ +Ahmed 4 +Basia 6 +Mehmet 17 +Leila 1 +Piotr 8 +Chandra 6 diff --git a/expect/jq/script-08.sh b/expect/jq/script-08.sh new file mode 100755 index 000000000..dd7e1d36c --- /dev/null +++ b/expect/jq/script-08.sh @@ -0,0 +1,6 @@ +Ahmed 3 +Basia 3 +Mehmet 3 +Leila 1 +Piotr 5 +Chandra 2 diff --git a/expect/jq/script-09.sh b/expect/jq/script-09.sh new file mode 100755 index 000000000..33ff777a7 --- /dev/null +++ b/expect/jq/script-09.sh @@ -0,0 +1,6 @@ +Ahmed 15 +Basia 37 +Mehmet 32 +Leila 1 +Piotr 61 +Chandra 18 diff --git a/expect/jq/script-10.sh b/expect/jq/script-10.sh new file mode 100755 index 000000000..fb1e7bc86 --- /dev/null +++ b/expect/jq/script-10.sh @@ -0,0 +1 @@ +54 diff --git a/expect/jq/script-11.sh b/expect/jq/script-11.sh new file mode 100755 index 000000000..4e9bdff0c --- /dev/null +++ b/expect/jq/script-11.sh @@ -0,0 +1 @@ +164 diff --git a/expect/shell-pipelines/ls-grep/script-01.sh b/expect/shell-pipelines/ls-grep/script-01.sh new file mode 100755 index 000000000..5481774df --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-01.sh @@ -0,0 +1,11 @@ +Ariane +Daniel +HoChiMinh +KualaLumpur +Levi +London +NewYork +Niamh +Olga +York +dHondt diff --git a/expect/shell-pipelines/ls-grep/script-02.sh b/expect/shell-pipelines/ls-grep/script-02.sh new file mode 100755 index 000000000..35f2e44e6 --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-02.sh @@ -0,0 +1,10 @@ +Ariane +Daniel +HoChiMinh +KualaLumpur +Levi +London +NewYork +Niamh +Olga +York diff --git a/expect/shell-pipelines/ls-grep/script-03.sh b/expect/shell-pipelines/ls-grep/script-03.sh new file mode 100755 index 000000000..37ec45084 --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-03.sh @@ -0,0 +1,7 @@ +Ariane +Daniel +Levi +London +Niamh +Olga +York diff --git a/expect/shell-pipelines/ls-grep/script-04.sh b/expect/shell-pipelines/ls-grep/script-04.sh new file mode 100755 index 000000000..7f8f011eb --- /dev/null +++ b/expect/shell-pipelines/ls-grep/script-04.sh @@ -0,0 +1 @@ +7 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-01.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-01.sh new file mode 100755 index 000000000..a622bc929 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-01.sh @@ -0,0 +1,6 @@ +Ahmed London 1 10 4 +Basia London 22 9 6 +Chandra Birmingham 12 6 +Leila London 1 +Mehmet Birmingham 3 12 17 +Piotr Glasgow 15 2 25 11 8 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-02.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-02.sh new file mode 100755 index 000000000..c560f609b --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-02.sh @@ -0,0 +1,6 @@ +Basia London 22 9 6 +Piotr Glasgow 15 2 25 11 8 +Chandra Birmingham 12 6 +Mehmet Birmingham 3 12 17 +Leila London 1 +Ahmed London 1 10 4 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-03.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-03.sh new file mode 100755 index 000000000..52d05bc65 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-03.sh @@ -0,0 +1,3 @@ +Basia London 22 9 6 +Piotr Glasgow 15 2 25 11 8 +Chandra Birmingham 12 6 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-04.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-04.sh new file mode 100755 index 000000000..9c18f93d6 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-04.sh @@ -0,0 +1 @@ +Piotr Glasgow 15 2 25 11 8 diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-05.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-05.sh new file mode 100755 index 000000000..5b6440e3f --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-05.sh @@ -0,0 +1,6 @@ +Entry German +Entry Mariana +Entry Sally +Exit German +Exit Mariana +Exit Sally diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-06.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-06.sh new file mode 100755 index 000000000..93bd06bc8 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-06.sh @@ -0,0 +1,2 @@ + 5 Entry + 4 Exit diff --git a/expect/shell-pipelines/sort-uniq-head-tail/script-07.sh b/expect/shell-pipelines/sort-uniq-head-tail/script-07.sh new file mode 100755 index 000000000..93bd06bc8 --- /dev/null +++ b/expect/shell-pipelines/sort-uniq-head-tail/script-07.sh @@ -0,0 +1,2 @@ + 5 Entry + 4 Exit diff --git a/expect/shell-pipelines/tr/script-01.sh b/expect/shell-pipelines/tr/script-01.sh new file mode 100755 index 000000000..8dea4ebf2 --- /dev/null +++ b/expect/shell-pipelines/tr/script-01.sh @@ -0,0 +1,11 @@ +Dear Yara, + +Mz apologies for sending this response so late. As zou know, there's been a lot going on. + +Unfortunatelz I don't think I'll be able to make it to Yimbabwe, but but sounds amaying. + +Hope zou're doing well, and enjoz the trip. + +Thanks, + +Karolina diff --git a/expect/shell-pipelines/tr/script-02.sh b/expect/shell-pipelines/tr/script-02.sh new file mode 100755 index 000000000..e00561af1 --- /dev/null +++ b/expect/shell-pipelines/tr/script-02.sh @@ -0,0 +1,11 @@ +Dear Zara, + +My apologies for sending this response so late. As you know, there's been a lot going on! + +Unfortunately I don't think I'll be able to make it to Zimbabwe, but but sounds amazing! + +Hope you're doing well, and enjoy the trip! + +Thanks, + +Karolina diff --git a/test-sdc.sh b/test-sdc.sh new file mode 100755 index 000000000..2d5341e83 --- /dev/null +++ b/test-sdc.sh @@ -0,0 +1,90 @@ +# This test file will be automatically run when you submit a pull request +# You should not modify this file +# You can run this file using ./test-sdc.sh task-directory-name to check your output +# You can use it with the individual-shell-tools, jq, and shell-pipelines tasks + +rm testoutput.txt +if [[ "$1" == "individual-shell-tools" ]]; then + cd individual-shell-tools + pass=0 + total=0 + for directory in */; do + cd $directory + if [ "$directory" == "helper-files/" ]; then + cd .. + continue + fi + for exercise in *.sh; do + total=$(($total+1)) + ./$exercise > ../../test.tmp + cmp ../../test.tmp ../../expect/individual-shell-tools/$directory$exercise --quiet + if [ $? -eq 0 ]; then + pass=$(($pass+1)) + else + if [[ "$exercise" == *"stretch"* ]]; then + # echo "Stretch task $directory$exercise failing, you can ignore this if you did not attempt. If you didnt, please have the volunteer check this." + echo "" >> ../../testoutput.txt + total=$(($total-1)) + else + echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt + fi + fi + done + cd .. + done + cd .. + rm test.tmp + echo "You passed $pass/$total tasks." >> testoutput.txt + if [ $pass -ge $total ]; then + echo "This task is complete!" >> testoutput.txt + fi + cat testoutput.txt +elif [[ "$1" == "shell-pipelines" ]]; then + cd shell-pipelines + pass=0 + total=0 + for directory in */; do + cd $directory + for exercise in *.sh; do + total=$(($total+1)) + ./$exercise > ../../test.tmp + cmp ../../test.tmp ../../expect/shell-pipelines/$directory$exercise --quiet + if [ $? -eq 0 ]; then + pass=$(($pass+1)) + else + echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt + fi + done + cd .. + done + cd .. + rm test.tmp + echo "You passed $pass/$total tasks." >> testoutput.txt + if [ $pass -eq $total ]; then + echo "This task is complete!" >> testoutput.txt + fi + cat testoutput.txt +elif [[ "$1" == "jq" ]]; then + cd jq + pass=0 + total=0 + for exercise in *.sh; do + total=$(($total+1)) + ./$exercise > ../test.tmp + cmp ../test.tmp ../expect/jq/$exercise --quiet + if [ $? -eq 0 ]; then + pass=$(($pass+1)) + else + echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt + fi + done + cd .. + rm test.tmp + echo "You passed $pass/$total tasks." >> testoutput.txt + if [ $pass -eq $total ]; then + echo "This task is complete!" >> testoutput.txt + fi + cat testoutput.txt +else + echo "Please run this with a valid test directory name as argument" +fi From da754c458d55229ec73cd89cb7e13fb280435b27 Mon Sep 17 00:00:00 2001 From: l Date: Tue, 31 Mar 2026 14:33:39 +0100 Subject: [PATCH 2/3] Simplify test yaml --- .github/workflows/test-sdc-tasks.yml | 15 ++++++--------- test-sdc.sh | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-sdc-tasks.yml b/.github/workflows/test-sdc-tasks.yml index 30369deaf..e2e992dba 100644 --- a/.github/workflows/test-sdc-tasks.yml +++ b/.github/workflows/test-sdc-tasks.yml @@ -8,6 +8,7 @@ on: - opened - edited - reopened + - synchronize jobs: test_sdc_tasks: @@ -24,33 +25,29 @@ jobs: id: changed-files uses: tj-actions/changed-files@v47.0.5 - name: test individual shell tools + id: test-individual-shell-tools if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') run: ./test-sdc.sh individual-shell-tools shell: bash - name: test jq + id: test-jq if: contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') run: ./test-sdc.sh jq shell: bash - name: test shell-pipelines + id: test-shell-pipelines if: contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') run: ./test-sdc.sh shell-pipelines shell: bash - name: make output comment - if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') + if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' env: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | gh issue comment $ISSUE_URL --body-FILE testoutput.TXT - - name: read test output - if: contains(steps.changed-files.outputs.all_changed_files, 'individual-shell-tools/awk/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'jq/script-01.sh') || contains(steps.changed-files.outputs.all_changed_files, 'shell-pipelines/ls-grep/script-01.sh') - id: read-test-output - run: | - echo 'testoutput<> $GITHUB_OUTPUT - cat testoutput.txt >> $GITHUB_OUTPUT - echo EOF >> $GITHUB_OUTPUT - name: add appropriate labels - if: contains(steps.read-test-output.outputs.testoutput, 'complete!') + if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' env: GH_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} diff --git a/test-sdc.sh b/test-sdc.sh index 2d5341e83..f208705dc 100755 --- a/test-sdc.sh +++ b/test-sdc.sh @@ -23,7 +23,6 @@ if [[ "$1" == "individual-shell-tools" ]]; then else if [[ "$exercise" == *"stretch"* ]]; then # echo "Stretch task $directory$exercise failing, you can ignore this if you did not attempt. If you didnt, please have the volunteer check this." - echo "" >> ../../testoutput.txt total=$(($total-1)) else echo "Failed $directory$exercise, please either attempt again or have the volunteer check this." >> ../../testoutput.txt @@ -35,8 +34,14 @@ if [[ "$1" == "individual-shell-tools" ]]; then cd .. rm test.tmp echo "You passed $pass/$total tasks." >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "attempted=y" >> "$GITHUB_OUTPUT" + fi if [ $pass -ge $total ]; then echo "This task is complete!" >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "complete=y" >> "$GITHUB_OUTPUT" + fi fi cat testoutput.txt elif [[ "$1" == "shell-pipelines" ]]; then @@ -60,8 +65,14 @@ elif [[ "$1" == "shell-pipelines" ]]; then cd .. rm test.tmp echo "You passed $pass/$total tasks." >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "attempted=y" >> "$GITHUB_OUTPUT" + fi if [ $pass -eq $total ]; then echo "This task is complete!" >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "complete=y" >> "$GITHUB_OUTPUT" + fi fi cat testoutput.txt elif [[ "$1" == "jq" ]]; then @@ -81,8 +92,14 @@ elif [[ "$1" == "jq" ]]; then cd .. rm test.tmp echo "You passed $pass/$total tasks." >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "attempted=y" >> "$GITHUB_OUTPUT" + fi if [ $pass -eq $total ]; then echo "This task is complete!" >> testoutput.txt + if [ -v GITHUB_OUTPUT ]; then + echo "complete=y" >> "$GITHUB_OUTPUT" + fi fi cat testoutput.txt else From 7059fa0a2a64a823df9e5d2748e7c5f9af112a92 Mon Sep 17 00:00:00 2001 From: l Date: Wed, 1 Apr 2026 10:36:45 +0100 Subject: [PATCH 3/3] test ls task --- individual-shell-tools/ls/script-01.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/individual-shell-tools/ls/script-01.sh b/individual-shell-tools/ls/script-01.sh index 241b62f5e..7a50d745b 100755 --- a/individual-shell-tools/ls/script-01.sh +++ b/individual-shell-tools/ls/script-01.sh @@ -13,3 +13,4 @@ fi # TODO: Write a command to list the files and folders in this directory. # The output should be a list of names including child-directory, script-01.sh, script-02.sh, and more. +ls .