-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (108 loc) · 3.95 KB
/
ci.yaml
File metadata and controls
125 lines (108 loc) · 3.95 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
120
121
122
123
124
125
---
name: CI
# yamllint disable-line rule:truthy
on:
[push, workflow_dispatch]
env:
# The version of caching we are using. This can be upgraded if we
# significantly change CI to the point where old caches become irrelevant.
CACHE_VERSION: 0
# Default Python version.
DEFAULT_PYTHON: 3.11
# Location of the pre-commit cache. This is set by pre-commit, not us!
PRE_COMMIT_CACHE: ~/.cache/pre-commit
# Cancels this run if a new one referring to the same object and same workflow
# is requested
concurrency:
group: >
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
ci:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Check out code from GitHub
uses: actions/checkout@v3.0.2
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'pip'
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pre-commit
- name: Restore cache for pre-commit
id: restore-pre-commit-cache
uses: actions/cache@v4.0.2
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: pre-commit-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ env.CACHE_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-${{ env.DEFAULT_PYTHON }}-${{ env.CACHE_VERSION }}-
- name: Install pre-commit
if: steps.restore-pre-commit-cache.outputs.cache-hit != 'true'
run: |
pre-commit install
- name: Run pre-commit
if: github.ref != 'refs/heads/main'
run: |
pre-commit run --all-files --show-diff-on-failure
- name: Run pre-commit
if: github.ref == 'refs/heads/main'
run: |
SKIP=no-commit-to-branch pre-commit run --all-files --show-diff-on-failure
- name: Run tests
env:
CODIO_CLIENT_ID: ${{ secrets.CODIO_CLIENT_ID }}
CODIO_CLIENT_SECRET: ${{ secrets.CODIO_CLIENT_SECRET }}
CANVAS_API_TOKEN: ${{ secrets.CANVAS_API_TOKEN }}
CANVAS_URL: ${{ secrets.CANVAS_URL }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
GUILD_ID: ${{ secrets.GUILD_ID }}
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
DEV_MODE: ${{ secrets.DEV_MODE }}
QUALTRICS_API_TOKEN: ${{ secrets.QUALTRICS_API_TOKEN }}
QUALTRICS_API_DATACENTER: ${{ secrets.QUALTRICS_API_DATACENTER }}
QUALTRICS_SURVEY_ID: ${{ secrets.QUALTRICS_SURVEY_ID }}
QUALTRICS_FILTER_ID: ${{ secrets.QUALTRICS_FILTER_ID }}
GRADESCOPE_EMAIL: ${{ secrets.GRADESCOPE_EMAIL }}
GRADESCOPE_PASSWORD: ${{ secrets.GRADESCOPE_PASSWORD }}
GRADESCOPE_COURSE_ID: ${{ secrets.GRADESCOPE_COURSE_ID }}
TOKEN_FOR_GH: ${{ secrets.TOKEN_FOR_GH }}
run: |
python -m pytest
build_docs:
name: Build and deploy docs
runs-on: ubuntu-latest
# needs: ci
# if: github.ref == 'refs/heads/main'
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: 'pip'
- name: Install pip dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Build docs
run: |
cd docs
make html
- name: Install netlify-cli
run: npm install netlify-cli@17.38.0 -g
- name: Deploy site
run: |
cd $GITHUB_WORKSPACE/docs
netlify deploy \
--dir _build/html \
--site ${{ secrets.NETLIFY_SITE_ID }} \
--auth ${{ secrets.NETLIFY_API_KEY }} \
--prod