-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (84 loc) · 2.7 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
# Run basic tests on the latest aiidalab/full-stack and ispg-group/atmospec docker images.
name: CI
on:
push:
branches:
- main
pull_request:
env:
FORCE_COLOR: 1
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out app
uses: actions/checkout@v4
- name: Set up Python with cache
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
- name: Run pre-commit
uses: pre-commit/[email protected]
test-app:
needs: pre-commit
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
packages: read
contents: read
strategy:
matrix:
tag: [latest]
image: ["aiidalab/full-stack", "ghcr.io/ispg-group/atmospec"]
browser: [Firefox, Chrome]
fail-fast: false
env:
IMAGE: ${{ matrix.image }}
TAG: ${{ matrix.tag }}
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check out app
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
**/requirements*.txt
- name: Install dependencies for tests
run: pip install -r requirements-test.txt
- 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
if: matrix.browser == 'Firefox'
uses: browser-actions/setup-firefox@latest
with:
firefox-version: "96.0"
- name: Install geckodriver
if: matrix.browser == 'Firefox'
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
- name: Run pytest
run: pytest -sv --driver ${{ matrix.browser }} -o cache_dir=$PYTEST_CACHE_DIR tests/app/
- name: Replace slashes in image name
if: always()
run: echo "IMAGE_NAME=${IMAGE//\//-}" >> $GITHUB_ENV
- name: Upload screenshots as artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: Screenshots-${{env.IMAGE_NAME}}-${{ matrix.tag }}-${{ matrix.browser }}
path: screenshots/
if-no-files-found: error