Skip to content

Automate testing of initial sprints in tools module #10

Automate testing of initial sprints in tools module

Automate testing of initial sprints in tools module #10

name: Test SDC Tasks
on:
pull_request:
types:
- opened
- labeled
- reopened
- synchronize
paths:
- '**.sh'
jobs:
test_sdc_tasks:
name: Test SDC Tasks
runs-on: ubuntu-slim
permissions:
pull-requests: write
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: 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'
env:
GH_TOKEN: ${{ github.token }}
ISSUE_URL: ${{ github.event.pull_request.html_url }}
run: |
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'
env:
GH_TOKEN: ${{ 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-individual-shell-tools.outputs.complete == 'y' || steps.test-jq.outputs.complete == 'y' || steps.test-shell-pipelines.outputs.complete == 'y')
run: |
exit -1