generated from StanfordSpezi/SpeziDataPipeline
-
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (114 loc) · 3.66 KB
/
build-and-test.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
#
# This source file is part of the Stanford Spezi open-source project
#
# SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#
name: Build and Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
workflow_call:
jobs:
pylint:
name: PyLint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install Infrastructure
run: |
python -m pip install --upgrade pip
pip install -e .
pip install toml
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
black_lint:
name: Black Code Formatter Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install Black
run: pip install black[jupyter]
- name: Check code formatting with Black
run: black . --exclude '\.ipynb$'
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install Infrastructure
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
- name: Run Unit Tests
run: pytest tests/*.py --cov=. --cov-report=xml -vv
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
slug: StanfordSpezi/SpeziDataPipelineTemplate
build_and_test_notebook:
name: Build and Test Notebook
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Setup NodeJS
uses: actions/setup-node@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "microsoft"
java-version: "17"
- name: Update apt-get
run: sudo apt-get update
- name: Setup LaTex
run: |
sudo apt-get install -y --fix-missing pandoc texlive-xetex texlive-fonts-recommended texlive-plain-generic
- name: Cache Firebase Emulators
uses: actions/cache@v3
with:
path: ~/.cache/firebase/emulators
key: ${{ runner.os }}-${{ runner.arch }}-firebase-emulators-${{ hashFiles('~/.cache/firebase/emulators/**') }}
- name: Install Firebase CLI Tools
run: npm install -g firebase-tools
- name: Install Infrastructure
run: |
python -m pip install --upgrade pip
pip install jupyterlab
- name: Install SpeziDataPipelineTemplate and Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
- name: Set Firestore Emulator Environment Variable
run: |
echo "FIRESTORE_EMULATOR_HOST=localhost:8080" >> $GITHUB_ENV
echo "GCLOUD_PROJECT=spezidatapipelinetemplate" >> $GITHUB_ENV
- name: Run Firebase Emulator & Execute Notebook
run: |
firebase emulators:exec --import=./sample_data "jupyter nbconvert --to pdf --execute SpeziDataPipelineTemplate.ipynb"
env:
CI: true
- uses: actions/upload-artifact@v4
with:
name: SpeziDataPipelineTemplate.pdf
path: SpeziDataPipelineTemplate.pdf