-
Notifications
You must be signed in to change notification settings - Fork 17
137 lines (109 loc) · 4.56 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
# Run unit tests and notebook tests on the latest aiidalab-docker image.
name: CI
on:
push:
branches:
- master
pull_request:
env:
FORCE_COLOR: "1"
UV_VERSION: "0.4.6"
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-notebooks:
strategy:
matrix:
browser: [Chrome, Firefox]
# test on the latest and the oldest supported version
aiida-core-version: [2.6.2]
fail-fast: false
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out app
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
- name: Install package test dependencies
# Notebook tests happen in the container, here we only need to install
# the pytest-docker dependency. Unfortunately, uv/pip does not allow to
# only install [dev] dependencies so we end up installing all the rest as well.
run: uv pip install --system .[dev]
- name: Set jupyter token env
run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV
# The Firefox and its engine geckodrive need do be installed manually to run
# selenium tests.
- name: Install Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: '96.0'
if: matrix.browser == 'Firefox'
- name: Install geckodriver
run: |
wget -c https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar xf geckodriver-v0.30.0-linux64.tar.gz -C /usr/local/bin
if: matrix.browser == 'Firefox'
- name: Run pytest
run: pytest -v --driver ${{ matrix.browser }} tests_notebooks
env:
TAG: pr-455
- name: Upload screenshots as artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: Screenshots-aiida-${{ matrix.aiida-core-version }}-${{ matrix.browser }}
path: screenshots/
if-no-files-found: error
test-package:
strategy:
matrix:
python-version: ['3.9', '3.11']
# Test on the latest and oldest supported version
aiida-core-version: [2.2.2, 2.6.2]
fail-fast: false
runs-on: ubuntu-latest
timeout-minutes: 30
services:
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
steps:
- name: Check out app
uses: actions/checkout@v4
- name: Install povray
run: sudo apt-get update && sudo apt-get install povray
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
- name: Install package
# NOTE: uv (unlike pip) does not compile python to bytecode after install.
# This uncovered a lot of SyntaxError(s) in the vapory package,
# since pip swallows these by default (WTH?).
# Ideally, these would be fixed, but vapory is largely unmaintained,
# so here we simply keep the pip behaviour with the --compile flag.
# See https://github.com/astral-sh/uv/issues/1928#issuecomment-1968857514
run: uv pip install --compile --system -e .[dev,smiles,optimade,eln] aiida-core==${{ matrix.aiida-core-version }}
- name: Run pytest
run: pytest -v tests --cov=aiidalab_widgets_base
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
flags: python-${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}