Skip to content

Commit

Permalink
CI: Add labels to issue and PR and improve output from submission wf (#…
Browse files Browse the repository at this point in the history
…481)

<!--
⚠️ If you do not respect this template, your pull request will be
closed.
⚠️ Your pull request title should be short detailed and understandable
for all.
⚠️ Also, please add a release note file using reno if the change needs
to be
  documented in the release notes.
⚠️ If your pull request fixes an open issue, please link to the issue.

- [ ] I have added the tests to cover my changes.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
-->

### Summary
Add labels to issue and PR from submission wf.
Improve the wf output.

### Details and comments
- [x] `submission` label to every submission issue and PR
- [x] `on hold` label to every submission issue and PR who doesn't pass
the standard check
- [x]  remove `on hold` label if the submission passed
- [x] `ready` label to every submission issue and PR who passed the
standard check
- [x] remove `ready` label if the submission doesn't passed anymore
- [x] Add a wf summary
- [x] Make the comment in the issue more clean
- [x] Make the comment in the PR more clean
- [x] Tests run
- [x] Clean

---
Closes #480

---------

Co-authored-by: Frank Harkins <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: frankharkins <[email protected]>
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
5 people authored Aug 17, 2023
1 parent ab68e79 commit fb86c84
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/submission.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Project submission
description: Ecosystem project submission
title: "[Submission]: "
labels: []
labels: ["submission"]
assignees:
- octocat
body:
Expand Down
201 changes: 125 additions & 76 deletions .github/workflows/ecosystem-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ name: Ecosystem | Submission check
# - install deps
# - parse issue
# - run lint, coverage, tests
# - comment result
# - link pr to issue
# - create pr
# - comment result and add labels

on:
issues:
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
pip install -r requirements.txt
pip install -r requirements-dev.txt
# workflow
# Python workflow
- name: Parse submission
id: parse-issue
env:
Expand All @@ -49,7 +49,7 @@ jobs:
test_type: "stable"
tox_env: ${{ env.tox_env }}
tier: ${{ env.tier }}
logs_link: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
logs_link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Tests dev check
id: dev
uses: ./.github/actions/run-tests
Expand All @@ -58,7 +58,7 @@ jobs:
test_type: "development"
tox_env: ${{ env.tox_env }}
tier: ${{ env.tier }}
logs_link: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
logs_link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Tests standard repo check
id: standard
uses: ./.github/actions/run-tests
Expand All @@ -67,33 +67,7 @@ jobs:
test_type: "standard"
tox_env: ${{ env.tox_env }}
tier: ${{ env.tier }}
logs_link: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

# Check result, update issue and create PR
- name: Check return
id: check-return
run: |
if [[ "${{ steps.standard.outputs.result }}" == *"True"* ]]; then
echo "::notice title=StandardCheck::Success"
echo "PASS_STD=True" >> "$GITHUB_OUTPUT"
else
echo "::error title=StandardCheck::Didn't pass"
echo "PASS_STD=False" >> "$GITHUB_OUTPUT"
fi
if [[ "${{ steps.stable.outputs.result }}" == *"True"* ]]; then
echo "::notice title=StableCheck::Success"
echo "PASS_STB=True" >> "$GITHUB_OUTPUT"
else
echo "::warning title=StableCheck::Didn't pass"
echo "PASS_STB=False" >> "$GITHUB_OUTPUT"
fi
if [[ "${{ steps.dev.outputs.result }}" == *"True"* ]]; then
echo "::notice title=DevCheck::Success"
echo "PASS_DEV=True" >> "$GITHUB_OUTPUT"
else
echo "::warning title=DevCheck::Didn't pass"
echo "PASS_DEV=False" >> "$GITHUB_OUTPUT"
fi
logs_link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

- name: Add member
env:
Expand All @@ -117,6 +91,7 @@ jobs:
--repo_labels="$SUBMISSION_LABELS" \
--repo_website="$SUBMISSION_WEBSITE"
# Create PR
- name: Commit changes and create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
Expand All @@ -125,63 +100,137 @@ jobs:
title: Add ${{ steps.parse-issue.outputs.SUBMISSION_NAME }} to list.
body: |
Add ${{ steps.parse-issue.outputs.SUBMISSION_NAME }} to list.
---
Closes #${{ github.event.issue.number }}
branch: submission-${{ github.event.issue.number }}
labels: submission
base: main

- name: Create comment on success for standard check
if: ${{ steps.check-return.outputs.PASS_STD == 'True' }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
Successfull submission! :sparkles: PR #${{ steps.cpr.outputs.pull-request-number }}
# Check result
## Gets results of repo tests, and creates comment to post into issue/PR
- name: Check test results
id: check-return
run: |
# STD check
echo "### Standard tests" >> $GITHUB_STEP_SUMMARY
if [[ "${{ steps.standard.outputs.result }}" == *"True"* ]]; then
echo "PASS_STD=True" >> "$GITHUB_OUTPUT"
echo ":sparkles: Successfull submission!" >> $GITHUB_STEP_SUMMARY
else
echo "PASS_STD=False" >> "$GITHUB_OUTPUT"
echo ":x: The submission didn't pass the standard check." >> $GITHUB_STEP_SUMMARY
echo "Please follow minimal requirements for project or/and add ecosystem.json configuration in the root of the project." >> $GITHUB_STEP_SUMMARY
echo "Read more here ${{ github.server_url }}/${{ github.repository }}/blob/main/docs/project_overview.md#adding-project-to-the-ecosystem." >> $GITHUB_STEP_SUMMARY
fi
- name: Create comment on failure
if: ${{ steps.check-return.outputs.PASS_STD != 'True' }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
Submission PR #${{ steps.cpr.outputs.pull-request-number }} has been created with errors in tests :warning:
See logs: https://github.com/qiskit-community/ecosystem/actions/runs/${{ github.run_id }}
Please follow minimal requirements for project or/and add `ecosystem.json` configuration in the root of the project
Read more here https://github.com/qiskit-community/ecosystem/blob/main/docs/project_overview.md#adding-project-to-the-ecosystem
# STB check
echo "### Stable tests" >> $GITHUB_STEP_SUMMARY
if [[ "${{ steps.stable.outputs.result }}" == *"True"* ]]; then
echo "PASS_STB=True" >> "$GITHUB_OUTPUT"
echo ":sparkles: Tests with latest version of Qiskit release passed!" >> $GITHUB_STEP_SUMMARY
else
echo "PASS_STB=False" >> "$GITHUB_OUTPUT"
echo ":warning: The submission didn't pass the stable check." >> $GITHUB_STEP_SUMMARY
echo "This means your project doesn't work with the latest version of Qiskit." >> $GITHUB_STEP_SUMMARY
echo "This is purely informational and doesn't affect your project joining the Ecosystem, but you may want to investigate the problem." >> $GITHUB_STEP_SUMMARY
fi
- name: Create comment on success for stable check
if: ${{ steps.check-return.outputs.PASS_STB == 'True' }}
uses: peter-evans/create-or-update-comment@v3
# DEV check
echo "### Development tests" >> $GITHUB_STEP_SUMMARY
if [[ "${{ steps.dev.outputs.result }}" == *"True"* ]]; then
echo "PASS_DEV=True" >> "$GITHUB_OUTPUT"
echo ":sparkles: Tests with development version of Qiskit release passed!" >> $GITHUB_STEP_SUMMARY
else
echo "PASS_DEV=False" >> "$GITHUB_OUTPUT"
echo ":warning: The submission didn't pass the development check." >> $GITHUB_STEP_SUMMARY
echo "This means your project might not work with the next version of Qiskit." >> $GITHUB_STEP_SUMMARY
echo "This is purely informational and doesn't affect your project joining Ecosystem." >> $GITHUB_STEP_SUMMARY
fi
# Gen info
echo "" >> $GITHUB_STEP_SUMMARY
echo "---" >> $GITHUB_STEP_SUMMARY
echo "Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
echo "PR #${{ steps.cpr.outputs.pull-request-number }}" >> $GITHUB_STEP_SUMMARY
# Create summary_output.md
echo "$(cat $GITHUB_STEP_SUMMARY)" > summary_output.md
# PR labels and comment
- name: "Label 'ready'"
continue-on-error: true
uses: actions/github-script@v6
if: ${{ steps.check-return.outputs.PASS_STD == 'True' }}
with:
issue-number: ${{ github.event.issue.number }}
body: |
Tests with latest version of Qiskit release passed! :sparkles:
script: |
// PR
github.rest.issues.addLabels({
issue_number: ${{ steps.cpr.outputs.pull-request-number }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["ready"]
})
github.rest.issues.removeLabel({
issue_number: ${{ steps.cpr.outputs.pull-request-number }},
owner: context.repo.owner,
repo: context.repo.repo,
name: ["on hold"]
})
// Issue
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["ready"]
})
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ["on hold"]
})
- name: Create comment on failure for stable check
if: ${{ steps.check-return.outputs.PASS_STB != 'True' }}
uses: peter-evans/create-or-update-comment@v3
- name: "Label 'on hold'"
continue-on-error: true
uses: actions/github-script@v6
if: ${{ steps.check-return.outputs.PASS_STD != 'True' }}
with:
issue-number: ${{ github.event.issue.number }}
body: |
Tests with latest version of Qiskit release failed! :warning:
This means your project doesn't work with the latest version of Qiskit.
This is purely informational and doesn't affect your project joining the Ecosystem, but you may want to investigate the problem.
See logs: https://github.com/qiskit-community/ecosystem/actions/runs/${{ github.run_id }}
script: |
// PR
github.rest.issues.addLabels({
issue_number: ${{ steps.cpr.outputs.pull-request-number }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["on hold"]
})
github.rest.issues.removeLabel({
issue_number: ${{ steps.cpr.outputs.pull-request-number }},
owner: context.repo.owner,
repo: context.repo.repo,
name: ["ready"]
})
// Issue
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["on hold"]
})
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ["ready"]
})
- name: Create comment on success for dev check
if: ${{ steps.check-return.outputs.PASS_DEV == 'True' }}
- name: "PR: Post comment"
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
Tests with development version of Qiskit release passed! :sparkles:
issue-number: ${{ steps.cpr.outputs.pull-request-number }}
body-path: "summary_output.md"

- name: Create comment on failure for dev check
if: ${{ steps.check-return.outputs.PASS_DEV != 'True' }}
- name: "Issue: Post comment"
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
Tests with development version of Qiskit release failed! :warning:
This means your project might not work with the next version of Qiskit.
This is purely informational and doesn't affect your project joining Ecosystem.
See logs: https://github.com/qiskit-community/ecosystem/actions/runs/${{ github.run_id }}
body-path: "summary_output.md"

0 comments on commit fb86c84

Please sign in to comment.