Test notebooks that submit jobs #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code is a Qiskit project. | |
# | |
# (C) Copyright IBM 2024. | |
# | |
# This code is licensed under the Apache License, Version 2.0. You may | |
# obtain a copy of this license in the LICENSE file in the root directory | |
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | |
# | |
# Any modifications or derivative works of this code must retain this | |
# copyright notice, and modified files need to carry a notice indicating | |
# that they have been altered from the originals. | |
name: Test notebooks that submit jobs | |
on: | |
schedule: | |
- cron: "0 7 1,15 * *" # At 07:00 on day-of-month 1 and 15. | |
workflow_dispatch: | |
jobs: | |
execute: | |
name: Execute notebooks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup environment | |
uses: ./.github/actions/set-up-notebook-testing | |
with: | |
ibm-quantum-token: ${{ secrets.IBM_QUANTUM_TEST_TOKEN }} | |
instance: "client-enablement/documentation/qiskit-documenta" | |
- name: Execute notebooks | |
timeout-minutes: 350 | |
run: tox -- --write --only-submit-jobs | |
- name: Detect changed notebooks | |
id: changed-notebooks | |
if: "!cancelled()" | |
run: | | |
echo "CHANGED_NOTEBOOKS<<EOF" >> $GITHUB_OUTPUT | |
git diff --name-only >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Upload executed notebooks | |
if: "!cancelled()" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Executed notebooks | |
path: ${{ steps.changed-notebooks.outputs.CHANGED_NOTEBOOKS }} | |
make_issue: | |
name: Make issue on failure | |
needs: [execute] | |
if: ${{ failure() && github.event_name == 'schedule' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Post issue | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const message = `Today's scheduled test of notebooks that submit jobs failed. | |
Please [check the logs](https://github.com/Qiskit/documentation/actions/runs/${{ github.run_id }}/). | |
> [!NOTE] | |
> This issue was created by a GitHub action. | |
` | |
github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: "Weekly notebook test failed", | |
body: message, | |
assignees: ["frankharkins", "javabster", "kevinsung",] | |
}) |