forked from aiidalab/aiidalab-widgets-base
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (117 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
138
139
140
141
142
143
144
145
146
147
148
149
150
---
# Run basic tests for this app on the latest aiidalab-docker image.
name: continuous-integration
on: [push, pull_request]
# 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:
pre-commit:
# Adapted from: https://github.com/CasperWA/voila-optimade-client
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: pip
cache-dependency-path: |
.pre-commit-config.yaml
**/setup.cfg
**/pyproject.toml
**/requirements*.txt
- uses: pre-commit/[email protected]
test-notebooks:
needs: [pre-commit]
strategy:
matrix:
tag: [latest]
browser: [Chrome, Firefox]
python-version: ['3.10']
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@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
**/requirements*.txt
- name: Install package test dependencies
# Test test will actually happened in the container, here only need to install
# the pytest-docker dependency.
# To add the dependencies to the container, we need to add them to the
# installation command in the `test_notebooks/conftest.py`.
run: pip install -e .[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: ${{ matrix.tag }}
- name: Upload screenshots as artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: Screenshots-${{ matrix.tag }}-${{ matrix.browser }}
path: screenshots/
if-no-files-found: error
test-package:
needs: [pre-commit]
strategy:
matrix:
tag: [latest]
python-version: ['3.9', '3.10']
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 install povray
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
**/requirements*.txt
- name: Install package
run: pip install -e .[dev,smiles,optimade]
- name: Run pytest
run: pytest -v tests --cov
env:
TAG: ${{ matrix.tag }}
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
flags: python-${{ matrix.python-version }}