Skip to content

Commit 743e491

Browse files
authored
Automate testing of initial sprints in tools module (#472)
* Expected output now in expected folder * Github action which runs after validation, when Needs Review * Script that can be run to test locally before push * Split number sys qs into automatable/manualy checkable --------- Co-authored-by: l <l>
1 parent 4350f48 commit 743e491

62 files changed

Lines changed: 561 additions & 68 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/validate-pr-metadata.yml

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Validate PR Metadata
1+
name: Validate PR Metadata and Check SDC-Tools Tasks
22
on:
3-
pull_request_target:
3+
pull_request:
44
types:
55
- labeled
6-
- unlabeled
76
- opened
87
- edited
98
- reopened
@@ -16,3 +15,55 @@ jobs:
1615
- uses: CodeYourFuture/actions/validate-pr-metadata@main
1716
with:
1817
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
19+
test_sdc_tasks:
20+
name: Test SDC Tasks
21+
runs-on: ubuntu-slim
22+
permissions:
23+
pull-requests: write
24+
if: ${{ github.event.label.name == 'Needs Review' }}
25+
steps:
26+
- name: checkout base branch
27+
uses: actions/checkout@v5
28+
- name: Get changed files
29+
id: changed-files
30+
uses: tj-actions/changed-files@v47.0.5
31+
- name: test individual shell tools
32+
id: test-individual-shell-tools
33+
if: contains(steps.changed-files.outputs.modified_files, 'individual-shell-tools/')
34+
run: ./test-sdc.sh individual-shell-tools
35+
shell: bash
36+
- name: test jq
37+
id: test-jq
38+
if: contains(steps.changed-files.outputs.modified_files, 'jq/')
39+
run: ./test-sdc.sh jq
40+
shell: bash
41+
- name: test shell-pipelines
42+
id: test-shell-pipelines
43+
if: contains(steps.changed-files.outputs.modified_files, 'shell-pipelines/')
44+
run: ./test-sdc.sh shell-pipelines
45+
shell: bash
46+
- name: test number-systems
47+
id: test-number-systems
48+
if: contains(steps.changed-files.outputs.modified_files, 'number-systems/')
49+
run: ./test-sdc.sh number-systems
50+
shell: bash
51+
- name: make output comment
52+
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'
53+
env:
54+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
ISSUE_URL: ${{ github.event.pull_request.html_url }}
56+
run: |
57+
gh pr comment $ISSUE_URL --body-file testoutput.txt
58+
- name: add appropriate labels
59+
if: steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y'
60+
env:
61+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
ISSUE_URL: ${{ github.event.pull_request.html_url }}
63+
run: |
64+
gh pr edit $ISSUE_URL --add-label "Complete"
65+
gh pr edit $ISSUE_URL --remove-label "Needs Review"
66+
- name: fail if not complete
67+
if: (steps.test-individual-shell-tools.outputs.attempted == 'y' || steps.test-jq.outputs.attempted == 'y' || steps.test-shell-pipelines.outputs.attempted == 'y') && !(steps.test-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y')
68+
run: |
69+
exit -1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
testoutput.txt
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Ahmed
2+
Basia
3+
Mehmet
4+
Leila
5+
Piotr
6+
Chandra
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Ahmed London
2+
Basia London
3+
Mehmet Birmingham
4+
Leila London
5+
Piotr Glasgow
6+
Chandra Birmingham
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Ahmed 1
2+
Basia 22
3+
Mehmet 3
4+
Leila 1
5+
Piotr 15
6+
Chandra 12
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Ahmed 4
2+
Basia 6
3+
Leila 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Ahmed 3
2+
Basia 3
3+
Mehmet 3
4+
Leila 1
5+
Piotr 5
6+
Chandra 2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
54
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Ahmed 15
2+
Basia 37
3+
Mehmet 32
4+
Leila 1
5+
Piotr 61
6+
Chandra 18
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Once upon a time...

0 commit comments

Comments
 (0)