-
Notifications
You must be signed in to change notification settings - Fork 8
119 lines (102 loc) · 3.89 KB
/
Copy pathci-tests-colab.yml
File metadata and controls
119 lines (102 loc) · 3.89 KB
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
name: CI Tests (Colab)
on:
push:
paths-ignore:
- 'paper/**'
- '.gitattributes'
- '.gitmodules'
- 'CITATION.cff'
- 'LICENSE'
- 'README.md'
workflow_dispatch:
inputs:
fork:
description: 'The fork on which to run the tests'
required: false
default: 'ContextLab'
commit:
description: 'The SHA to checkout (defaults to ref that triggered workflow)'
required: false
default: 'default'
debug_enabled:
description: 'Pause before tests for tmate debugging'
required: false
default: 'false'
defaults:
run:
shell: bash -leo pipefail {0}
jobs:
run-tests:
name: "Run Colab CI Tests (Python 3.7, IPython 7.9.0)"
runs-on: ubuntu-latest
# run if triggered by any of the following:
# - a workflow_dispatch event (manual or from trigger-colab-tests-pr workflow)
# - a push to paxtonfitzpatrick/davos
# - a push to ContextLab/davos
# don't run on any pull requests because:
# - pull requests between branches duplicate checks run by pushing to the head branch
# - pull requests between forks are handled by the workflow_dispatch setup
if: >
github.event_name == 'workflow_dispatch'
|| (github.event_name == 'push' && github.repository_owner == 'paxtonfitzpatrick')
|| (github.event_name == 'push' && github.repository_owner == 'ContextLab')
env:
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts
GMAIL_ADDRESS: ${{ secrets.DAVOS_GMAIL_ADDRESS }}
GMAIL_PASSWORD: ${{ secrets.DAVOS_GMAIL_PASSWORD }}
HEAD_FORK: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.fork || github.repository_owner }}
IPYTHON_VERSION: 7.9.0
NOTEBOOK_TYPE: colab
PYTHON_VERSION: 3.7
RECOVERY_GMAIL_ADDRESS: ${{ secrets.DAVOS_RECOVERY_GMAIL_ADDRESS }}
steps:
- name: Determine fork and commit SHA
run: |
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
head_sha=${{ github.event.inputs.commit }}
[[ "$head_sha" == "default" ]] && head_sha="$GITHUB_SHA"
else
head_sha="$GITHUB_SHA"
fi
echo "HEAD_SHA=$head_sha" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
repository: ${{ env.HEAD_FORK }}/davos
ref: ${{ env.HEAD_SHA }}
- name: install miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: true
activate-environment: ""
- name: setup base environment
run: |
# install Python 3.9 (used to run notebooks via selenium, not the tests themselves)
conda install python=3.9
# install Firefox browser
sudo apt-get install firefox
# install python packages
pip install pytest==6.2 "selenium==3.141" geckodriver-autoinstaller
# install geckodriver
driver_path=$(python -c '
from pathlib import Path
import geckodriver_autoinstaller
driver_src = Path(geckodriver_autoinstaller.install(cwd=True))
driver_dest = driver_src.rename(driver_src.parents[1].joinpath(driver_src.name))
driver_src.parent.rmdir()
print(driver_dest)
')
# export path to driver as environment variable
echo "DRIVER_PATH=$driver_path" >> $GITHUB_ENV
- name: debug runner
if: github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true'
uses: mxschmitt/action-tmate@v3
- name: run pytest
id: run-pytest
run: pytest -sv tests/
- name: upload selenium error artifacts
if: failure() && steps.run-pytest.outcome == 'failure'
uses: actions/upload-artifact@v2
with:
path: ${{ env.ARTIFACTS_DIR }}
if-no-files-found: ignore