Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4350f48
Fix expected output in sed exercise instructions (#353)
Abubakar-Meigag Mar 11, 2026
743e491
Automate testing of initial sprints in tools module (#472)
LonMcGregor May 11, 2026
f38fee5
Make test-sdc script more portable (#520)
illicitonion May 12, 2026
ab33fa5
Add automated tests for cowsay implementation (#521)
illicitonion May 12, 2026
d3857c2
Improve cowsay comments (#522)
illicitonion May 13, 2026
47e4131
switching last two hex questions (#533)
Poonam-raj Jun 10, 2026
3f26722
Add more expected test cases for ls implementations (#441)
illicitonion Jun 24, 2026
78bdfd5
cat implemented
Alex-Jamshidi Jul 28, 2026
60b323e
cat updated
Alex-Jamshidi Jul 28, 2026
3a35a7a
wc implemented
Alex-Jamshidi Jul 28, 2026
085224e
ls complete
Alex-Jamshidi Jul 30, 2026
b28f41d
remove unused code
Alex-Jamshidi Jul 31, 2026
7d6a298
updated eronious boolean in ls
Alex-Jamshidi Aug 12, 2026
fce72f0
updated ls so that data doesn't rely on global variables and is passe…
Alex-Jamshidi Aug 28, 2026
14d4d33
updated flag a
Alex-Jamshidi Aug 28, 2026
2b981ed
collapsed getuserargs function
Alex-Jamshidi Aug 28, 2026
fa7436b
rearranged some argument orders in ls
Alex-Jamshidi Aug 28, 2026
d4720b1
added comments to ls
Alex-Jamshidi Aug 28, 2026
5c64429
further added comments to ls
Alex-Jamshidi Aug 28, 2026
769706f
wc refactored
Alex-Jamshidi Aug 28, 2026
65e60ae
refactored cat
Alex-Jamshidi Aug 28, 2026
efdd20b
updated getcwd
Alex-Jamshidi Aug 29, 2026
61a6eaa
Add .venv to gitignore
Alex-Jamshidi Aug 29, 2026
eeb4d7a
removed implement shell tools files
Alex-Jamshidi Aug 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 61 additions & 3 deletions .github/workflows/validate-pr-metadata.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Validate PR Metadata
name: Validate PR Metadata and Check SDC-Tools Tasks
on:
pull_request_target:
pull_request:
types:
- labeled
- unlabeled
- opened
- edited
- reopened
Expand All @@ -16,3 +15,62 @@ jobs:
- uses: CodeYourFuture/actions/validate-pr-metadata@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test_sdc_tasks:
name: Test SDC Tasks
runs-on: ubuntu-slim
permissions:
pull-requests: write
if: ${{ github.event.label.name == 'Needs Review' }}
steps:
- name: checkout base branch
uses: actions/checkout@v5
- name: Get changed files
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.modified_files, 'individual-shell-tools/')
run: ./test-sdc.sh individual-shell-tools
shell: bash
- name: test jq
id: test-jq
if: contains(steps.changed-files.outputs.modified_files, 'jq/')
run: ./test-sdc.sh jq
shell: bash
- name: test shell-pipelines
id: test-shell-pipelines
if: contains(steps.changed-files.outputs.modified_files, 'shell-pipelines/')
run: ./test-sdc.sh shell-pipelines
shell: bash
- name: test number-systems
id: test-number-systems
if: contains(steps.changed-files.outputs.modified_files, 'number-systems/')
run: ./test-sdc.sh number-systems
shell: bash
- name: test implement-cowsay
id: test-implement-cowsay
if: contains(steps.changed-files.outputs.all_modified_files, 'implement-cowsay/')
run: ./test-sdc.sh implement-cowsay
shell: bash
- name: make output comment
if: steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' || steps.test-number-systems.outputs.attempted == 'y' || steps.test-implement-cowsay.outputs.attempted == 'y'
env:
Comment on lines +57 to +58

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot Sep 29, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the new test_sdc_tasks job, the same or very similar long boolean expressions are repeated in multiple if: conditions (for example, the list of steps.*.outputs.attempted checks in make output comment and fail if not complete, and the list of steps.*.outputs.complete checks in add appropriate labels).

This isn’t a functional bug, but it does mean that whenever you add or remove a task (e.g. another directory to test), you’d need to remember to update several separate if: expressions in exactly the same way. That’s often how inconsistencies creep in over time.

Would it be possible to centralise the notion of "any task attempted" and "any task complete" using a single step whose output you reuse, or by grouping these conditions in one place (for example via a small helper step that sets a combined output flag)? That way, adding a new task would only require updating one location, and the job-level conditions would stay in sync automatically.

To "like" or "dislike" this comment, please follow this link

GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_URL: ${{ github.event.pull_request.html_url }}
run: |
gh release -R CodeYourFuture/trainee-tracker view --json assets -q ".assets[] | select(.name | startswith(\"pr-metadata-validator-musl-\")).url" | xargs curl --fail -L -o /tmp/pr-metadata-validator && chmod 0755 /tmp/pr-metadata-validator
/tmp/pr-metadata-validator --only-close-existing-comments-with-tag="sdc-test-results" "${ISSUE_URL}"
gh pr comment $ISSUE_URL --body-file testoutput.txt
- name: add appropriate labels
if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' || steps.test-implement-cowsay.outputs.complete == 'y'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr edit $ISSUE_URL --add-label "Complete"
gh pr edit $ISSUE_URL --remove-label "Needs Review"
- name: fail if not complete
if: (steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y' || steps.test-implement-cowsay.outputs.attempted == 'y') && !(steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y' || steps.test-implement-cowsay.outputs.complete == 'y')
run: |
exit -1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
testoutput.txt
10 changes: 10 additions & 0 deletions expect/implement-cowsay/cow-grass.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
________________
| Grass, delicious |
================
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| ||
22 changes: 22 additions & 0 deletions expect/implement-cowsay/turtle-fish.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
______________
| Fish are cool! |
==============
\
\
\
\
___-------___
_-~~ ~~-_
_-~ /~-_
/^\__/^\ /~ \ / \
/| O|| O| / \_______________/ \
| |___||__| / / \ \
| \ / / \ \
| (_______) /______/ \_________ \
| / / \ / \
\ \^\\ \ / \ /
\ || \______________/ _-_ //\__//
\ ||------_-~~-_ ------------- \ --/~ ~\ || __/
~-----||====/~ |==================| |/~~~~~
(_(__/ ./ / \_\ \.
(_(___/ \_____)_)
6 changes: 6 additions & 0 deletions expect/individual-shell-tools/awk/script-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed
Basia
Mehmet
Leila
Piotr
Chandra
6 changes: 6 additions & 0 deletions expect/individual-shell-tools/awk/script-02.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed London
Basia London
Mehmet Birmingham
Leila London
Piotr Glasgow
Chandra Birmingham
6 changes: 6 additions & 0 deletions expect/individual-shell-tools/awk/script-03.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed 1
Basia 22
Mehmet 3
Leila 1
Piotr 15
Chandra 12
3 changes: 3 additions & 0 deletions expect/individual-shell-tools/awk/script-04.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ahmed 4
Basia 6
Leila 1
6 changes: 6 additions & 0 deletions expect/individual-shell-tools/awk/script-05.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed 3
Basia 3
Mehmet 3
Leila 1
Piotr 5
Chandra 2
1 change: 1 addition & 0 deletions expect/individual-shell-tools/awk/script-06-stretch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
54
6 changes: 6 additions & 0 deletions expect/individual-shell-tools/awk/script-07-stretch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed 15
Basia 37
Mehmet 32
Leila 1
Piotr 61
Chandra 18
1 change: 1 addition & 0 deletions expect/individual-shell-tools/cat/script-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Once upon a time...
5 changes: 5 additions & 0 deletions expect/individual-shell-tools/cat/script-02.sh
Original file line number Diff line number Diff line change
@@ -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...
3 changes: 3 additions & 0 deletions expect/individual-shell-tools/cat/script-03.sh
Original file line number Diff line number Diff line change
@@ -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...
5 changes: 5 additions & 0 deletions expect/individual-shell-tools/cat/script-04-stretch.sh
Original file line number Diff line number Diff line change
@@ -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...
6 changes: 6 additions & 0 deletions expect/individual-shell-tools/grep/script-01.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions expect/individual-shell-tools/grep/script-02.sh
Original file line number Diff line number Diff line change
@@ -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?
1 change: 1 addition & 0 deletions expect/individual-shell-tools/grep/script-03.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
10 changes: 10 additions & 0 deletions expect/individual-shell-tools/grep/script-04.sh
Original file line number Diff line number Diff line change
@@ -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!
5 changes: 5 additions & 0 deletions expect/individual-shell-tools/grep/script-05.sh
Original file line number Diff line number Diff line change
@@ -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?
2 changes: 2 additions & 0 deletions expect/individual-shell-tools/grep/script-06.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dialogue-2.txt
dialogue.txt
3 changes: 3 additions & 0 deletions expect/individual-shell-tools/grep/script-07.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dialogue-2.txt:2
dialogue-3.txt:0
dialogue.txt:6
5 changes: 5 additions & 0 deletions expect/individual-shell-tools/ls/script-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
child-directory
script-01.sh
script-02.sh
script-03.sh
script-04.sh
3 changes: 3 additions & 0 deletions expect/individual-shell-tools/ls/script-02.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
helper-1.txt
helper-2.txt
helper-3.txt
11 changes: 11 additions & 0 deletions expect/individual-shell-tools/ls/script-03.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions expect/individual-shell-tools/ls/script-04.sh
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions expect/individual-shell-tools/sed/script-01.sh
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions expect/individual-shell-tools/sed/script-02.sh
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions expect/individual-shell-tools/sed/script-03.sh
Original file line number Diff line number Diff line change
@@ -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:

11 changes: 11 additions & 0 deletions expect/individual-shell-tools/sed/script-04.sh
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions expect/individual-shell-tools/sed/script-05.sh
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions expect/individual-shell-tools/sed/script-06.sh
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions expect/individual-shell-tools/wc/script-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19 ../helper-files/helper-3.txt
1 change: 1 addition & 0 deletions expect/individual-shell-tools/wc/script-02.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3 ../helper-files/helper-3.txt
4 changes: 4 additions & 0 deletions expect/individual-shell-tools/wc/script-03.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions expect/jq/script-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Selma
1 change: 1 addition & 0 deletions expect/jq/script-02.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
35 Fashion Street, London, E1 6PX
2 changes: 2 additions & 0 deletions expect/jq/script-03.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Selma, Software Engineer
Selma, Software Engineer
6 changes: 6 additions & 0 deletions expect/jq/script-04.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed
Basia
Mehmet
Leila
Piotr
Chandra
6 changes: 6 additions & 0 deletions expect/jq/script-05.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed London
Basia London
Mehmet Birmingham
Leila London
Piotr Glasgow
Chandra Birmingham
6 changes: 6 additions & 0 deletions expect/jq/script-06.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed 1
Basia 22
Mehmet 3
Leila 1
Piotr 15
Chandra 12
6 changes: 6 additions & 0 deletions expect/jq/script-07.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed 4
Basia 6
Mehmet 17
Leila 1
Piotr 8
Chandra 6
6 changes: 6 additions & 0 deletions expect/jq/script-08.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed 3
Basia 3
Mehmet 3
Leila 1
Piotr 5
Chandra 2
6 changes: 6 additions & 0 deletions expect/jq/script-09.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Ahmed 15
Basia 37
Mehmet 32
Leila 1
Piotr 61
Chandra 18
1 change: 1 addition & 0 deletions expect/jq/script-10.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
54
1 change: 1 addition & 0 deletions expect/jq/script-11.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
164
1 change: 1 addition & 0 deletions expect/number-systems/Part-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"answers": [0, 1110, 45, 1000, "01011", 11111, 100010, 15, 8, 2, "(10$|10[^0-9])", "E", 182, 902, 11, 33]}
11 changes: 11 additions & 0 deletions expect/shell-pipelines/ls-grep/script-01.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Ariane
Daniel
HoChiMinh
KualaLumpur
Levi
London
NewYork
Niamh
Olga
York
dHondt
10 changes: 10 additions & 0 deletions expect/shell-pipelines/ls-grep/script-02.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Ariane
Daniel
HoChiMinh
KualaLumpur
Levi
London
NewYork
Niamh
Olga
York
Loading
Loading