Skip to content

Commit 4c87cac

Browse files
committed
Remove mamba and add failed action report
1 parent 71ad984 commit 4c87cac

File tree

3 files changed

+76
-17
lines changed

3 files changed

+76
-17
lines changed

.github/workflows/nightly_ci.yaml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,28 @@ jobs:
2020
- qutip-version: '5'
2121
qutip-branch: 'master'
2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
- uses: gaurav-nelson/github-action-markdown-link-check@v1
2525
with:
2626
use-quiet-mode: 'yes'
2727
folder-path: tutorials-v${{ matrix.qutip-version }}
28-
#use config file to define 403 and 405 errors as valid links
28+
#use config file to define 403 and 405 errors as valid links
2929
#(APS blocks this link check)
3030
config-file: mlc_config.json
3131

32-
- name: Setup Mambaforge
33-
uses: conda-incubator/setup-miniconda@v2
32+
- name: Setup Conda
33+
uses: conda-incubator/setup-miniconda@v3
3434
with:
35-
miniforge-variant: Mambaforge
3635
miniforge-version: latest
3736
activate-environment: test-environment-v${{ matrix.qutip-version }}
38-
use-mamba: true
3937

4038
- name: Get Date
4139
id: get-date
4240
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
4341
shell: bash
4442

4543
- name: Cache Conda env
46-
uses: actions/cache@v2
44+
uses: actions/cache@v3
4745
with:
4846
path: ${{ env.CONDA }}/envs
4947
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('test_environment.yml') }}-${{ env.CACHE_NUMBER }}-qutip-${{ matrix.qutip-version }}
@@ -54,7 +52,7 @@ jobs:
5452

5553
- name: Install environment
5654
if: steps.cache.outputs.cache-hit != 'true'
57-
run: mamba env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml
55+
run: conda env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml
5856

5957
- name: Install QuTiP
6058
run: |
@@ -107,3 +105,20 @@ jobs:
107105
path: |
108106
notebooks/*.ipynb
109107
notebooks/**/*.ipynb
108+
109+
110+
finalise:
111+
needs: pytests
112+
if: failure()
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@v4
116+
- name: Open Issue on Failure
117+
env:
118+
GITHUB_TOKEN: ${{ github.token }}
119+
run: |
120+
if [[ -z "${{ inputs.open_issue }}" ]] || [[ "${{ inputs.open_issue }}" != "False" ]];
121+
then
122+
pip install requests
123+
python tools/report_failing_tests.py $GITHUB_TOKEN
124+
fi

.github/workflows/notebook_ci.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,29 @@ jobs:
2121
- qutip-version: '5'
2222
qutip-branch: 'master'
2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525

2626
- uses: gaurav-nelson/github-action-markdown-link-check@v1
2727
with:
2828
use-quiet-mode: 'yes'
2929
folder-path: tutorials-v${{ matrix.qutip-version }}
30-
#use config file to define 403 and 405 errors as valid links
30+
#use config file to define 403 and 405 errors as valid links
3131
#(APS blocks this link check)
3232
config-file: mlc_config.json
3333

34-
- name: Setup Mambaforge
35-
uses: conda-incubator/setup-miniconda@v2
34+
- name: Setup Conda
35+
uses: conda-incubator/setup-miniconda@v3
3636
with:
37-
miniforge-variant: Mambaforge
3837
miniforge-version: latest
3938
activate-environment: test-environment-v${{ matrix.qutip-version }}
40-
use-mamba: true
4139

4240
- name: Get Date
4341
id: get-date
4442
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
4543
shell: bash
4644

4745
- name: Cache Conda env
48-
uses: actions/cache@v2
46+
uses: actions/cache@v3
4947
with:
5048
path: ${{ env.CONDA }}/envs
5149
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('test_environment.yml') }}-${{ env.CACHE_NUMBER }}-qutip-${{ matrix.qutip-version }}
@@ -56,7 +54,7 @@ jobs:
5654

5755
- name: Install environment
5856
if: steps.cache.outputs.cache-hit != 'true'
59-
run: mamba env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml
57+
run: conda env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml
6058

6159
- name: Install QuTiP
6260
run: |
@@ -114,7 +112,7 @@ jobs:
114112
runs-on: ubuntu-latest
115113
if: ${{ github.repository == 'qutip/qutip-tutorials' && github.ref == 'refs/heads/main' }}
116114
steps:
117-
- uses: actions/checkout@v3
115+
- uses: actions/checkout@v4
118116
- uses: actions/download-artifact@v4
119117
with:
120118
name: executed-notebooks-v4

tools/report_failing_tests.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
import requests
3+
import json
4+
import sys
5+
import argparse
6+
from datetime import date
7+
8+
def open_issue(token):
9+
url = "https://api.github.com/repos/qutip/qutip-jax/issues"
10+
data = json.dumps({
11+
"title": f"Automated tests failed on {date.today()}",
12+
"labels": ["bug"],
13+
"body": "Scheduled test failed!"
14+
})
15+
16+
headers = {
17+
"Accept": "application/vnd.github.v3+json",
18+
"Authorization" : f"token {token}",
19+
}
20+
21+
post_request = requests.post(url=url, data=data, headers=headers)
22+
23+
if post_request.status_code == 201:
24+
print("Success")
25+
26+
else:
27+
print(
28+
"Fail:",
29+
post_request.status_code,
30+
post_request.reason,
31+
post_request.content
32+
)
33+
34+
35+
def main():
36+
parser = argparse.ArgumentParser(
37+
description="""Open an issue on failed tests."""
38+
)
39+
parser.add_argument("token")
40+
args = parser.parse_args()
41+
print(args.token)
42+
open_issue(args.token)
43+
44+
45+
if __name__ == "__main__":
46+
sys.exit(main())

0 commit comments

Comments
 (0)