Skip to content

Test learning platform upload tool #19

Test learning platform upload tool

Test learning platform upload tool #19

# This code is a Qiskit project.
#
# (C) Copyright IBM 2023.
#
# 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 learning platform upload tool
on:
pull_request:
paths:
- "scripts/ibm-quantum-learning-uploader/**"
workflow_dispatch:
schedule:
# At 08:00 on Monday (https://crontab.guru/#0_8_*_*_1)
- cron: "0 8 * * 1"
jobs:
e2e:
name: End-to-end test
environment: "Learning platform (staging)"
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Firefox
uses: browser-actions/setup-firefox@v1
- name: Run test
run: |
cd scripts/ibm-quantum-learning-uploader/test
./e2e-test.sh
env:
LEARNING_API_TOKEN: ${{ secrets.LEARNING_API_TOKEN_STAGING }}
LEARNING_API_ENVIRONMENT: ${{ vars.LEARNING_API_ENVIRONMENT }}
make_issue:
name: Make issue on failure
needs: [e2e]
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 e2e test of the upload tool 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: "Learning upload tool test failed",
body: message,
assignees: ["frankharkins"]
})