-
-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (153 loc) · 6.06 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
151
152
153
154
155
156
157
158
159
name: CI
on:
push:
branches:
- "**"
- "!open-in-colab"
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * THU"
workflow_dispatch:
jobs:
test_library:
runs-on: ubuntu-latest
container: ubuntu:rolling
steps:
- name: Install git
run: |
apt update -y -q
apt install -y -qq git
- name: Mark workspace as safe
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- uses: actions/checkout@v4
with:
set-safe-directory: false
- name: Install non-pip dependencies of the workflow call library
run: |
export DEBIAN_FRONTEND="noninteractive"
apt install -y -qq imagemagick inkscape python3-pip wget
wget https://github.com/rclone/rclone/releases/download/v1.65.0/rclone-v1.65.0-linux-amd64.deb -O /tmp/rclone-v1.65.0-linux-amd64.deb
dpkg -i /tmp/rclone-v1.65.0-linux-amd64.deb
rm /usr/lib/python3.*/EXTERNALLY-MANAGED
- name: Install the workflow call library
run: |
python3 -m pip install .[docs,lint,tests]
- name: Clean build files
run: |
git clean -xdf
- name: Run ruff
run: |
python3 -m ruff check .
python3 -m nbqa ruff .
- name: Run isort
run: |
python3 -m isort --check --diff .
python3 -m nbqa isort --check --diff .
- name: Run mypy
run: |
python3 -m mypy .
python3 -m nbqa mypy .
- name: Run yamllint
run: |
python3 -m yamllint -d "{extends: default, rules: {document-start: {present: false}, line-length: disable, truthy: {check-keys: false}}}" .
- name: Run documentation generation
run: |
cd docs && python3 -m sphinx -W -b html . build/html
- name: Run tests
run: |
python3 -m coverage run --source=open_in_cloud_workflow -m pytest tests
env:
RCLONE_CONFIG_DRIVE_CLIENT_ID: "${{ secrets.RCLONE_CONFIG_DRIVE_CLIENT_ID }}"
RCLONE_CONFIG_DRIVE_CLIENT_SECRET: "${{ secrets.RCLONE_CONFIG_DRIVE_CLIENT_SECRET }}"
RCLONE_CONFIG_DRIVE_TOKEN: "${{ secrets.RCLONE_CONFIG_DRIVE_TOKEN }}"
- name: Check test coverage
run: |
python3 -m coverage report --fail-under=100 --show-missing --skip-covered
test_workflow_artifact:
needs: [test_library]
uses: fem-on-colab/open-in-colab-workflow/.github/workflows/workflow_call.yml@main
with:
work_directory: open_in_colab
notebook_pattern: "**/*.ipynb"
extra_files_pattern: "**/*.dat"
notebook_preparation: |
rsync -avz --include "*/" --include="*.ipynb" --exclude="*" tests open_in_colab/
extra_files_preparation: |
rsync -avz --include "*/" --include="*.png" --include="*.jpg" --include="*.svg" --exclude="*" tests open_in_colab/
mkdir -p open_in_colab/tests/data/extras/
echo "This is an extra file" > open_in_colab/tests/data/extras/extra.dat
fem_on_colab_packages: |
mpi4py
pip_packages: |
python-dateutil$dateutil
kaleido%plotly
itkwidgets
test_script: |
python3 -m pip install plotly
python3 -m pytest --nbval open_in_colab/tests
publish_on: artifact@open-in-colab
publish_if_repository: fem-on-colab/open-in-colab-workflow
test_workflow_drive:
needs: [test_library]
uses: fem-on-colab/open-in-colab-workflow/.github/workflows/workflow_call.yml@main
with:
work_directory: open_in_colab
notebook_pattern: "**/*.ipynb"
extra_files_pattern: "**/*.dat"
notebook_preparation: |
rsync -avz --include "*/" --include="*.ipynb" --exclude="*" tests open_in_colab/
extra_files_preparation: |
rsync -avz --include "*/" --include="*.png" --include="*.jpg" --include="*.svg" --exclude="*" tests open_in_colab/
mkdir -p open_in_colab/tests/data/extras/
echo "This is an extra file" > open_in_colab/tests/data/extras/extra.dat
fem_on_colab_packages: |
mpi4py
pip_packages: |
python-dateutil$dateutil
kaleido%plotly
itkwidgets
test_script: |
python3 -m pip install plotly
python3 -m pytest --nbval open_in_colab/tests
publish_on: drive@GitHub/open_in_colab_workflow
publish_if_repository: fem-on-colab/open-in-colab-workflow
secrets:
RCLONE_CONFIG_DRIVE_CLIENT_ID: "${{ secrets.RCLONE_CONFIG_DRIVE_CLIENT_ID }}"
RCLONE_CONFIG_DRIVE_CLIENT_SECRET: "${{ secrets.RCLONE_CONFIG_DRIVE_CLIENT_SECRET }}"
RCLONE_CONFIG_DRIVE_TOKEN: "${{ secrets.RCLONE_CONFIG_DRIVE_TOKEN }}"
test_workflow_github:
needs: [test_library]
uses: fem-on-colab/open-in-colab-workflow/.github/workflows/workflow_call.yml@main
with:
work_directory: open_in_colab
notebook_pattern: "**/*.ipynb"
extra_files_pattern: "**/*.dat"
notebook_preparation: |
rsync -avz --delete --include "*/" --include="*.ipynb" --exclude="*" tests open_in_colab/
extra_files_preparation: |
rsync -avz --delete --include "*/" --include="*.png" --include="*.jpg" --include="*.svg" --exclude="*" tests open_in_colab/
mkdir -p open_in_colab/tests/data/extras/
echo "This is an extra file" > open_in_colab/tests/data/extras/extra.dat
fem_on_colab_packages: |
mpi4py
pip_packages: |
python-dateutil$dateutil
kaleido%plotly
itkwidgets
test_script: |
python3 -m pip install plotly
python3 -m pytest --nbval open_in_colab/tests
publish_on: github@fem-on-colab/open-in-colab-workflow@open-in-colab
publish_if_repository: fem-on-colab/open-in-colab-workflow
warn:
runs-on: ubuntu-latest
if: github.repository == 'fem-on-colab/open-in-colab-workflow' && github.ref == 'refs/heads/main' && github.event_name == 'schedule'
steps:
- name: Warn if scheduled workflow is about to be disabled
uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@main
with:
workflow-filename: ci.yml
days-elapsed: 50