-
Notifications
You must be signed in to change notification settings - Fork 13
153 lines (147 loc) · 5 KB
/
build.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
name: build
on:
push:
branches: [release]
pull_request:
branches: [release, main, staging]
jobs:
test:
runs-on: ubuntu-latest
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
strategy:
fail-fast: false
matrix:
group:
- "unit"
- "tutorial"
- "guide"
- "biology"
- "faq"
- "storage"
- "cli"
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: ".github/workflows/build.yml"
- name: cache pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: cache postgres
if: ${{ matrix.group == 'faq' || matrix.group == 'unit' }}
id: cache-postgres
uses: actions/cache@v3
with:
path: ~/postgres.tar
key: cache-postgres-0
- name: cache postgres miss
if: ${{ steps.cache-postgres.outputs.cache-hit != 'true' && matrix.group == 'faq' || matrix.group == 'unit' }}
run: docker pull postgres:latest && docker image save postgres:latest --output ~/postgres.tar
- name: cache postgres use
if: ${{ steps.cache-postgres.outputs.cache-hit == 'true' && matrix.group == 'faq' || matrix.group == 'unit' }}
run: docker image load --input ~/postgres.tar
- run: pip install -U laminci
- name: install postgres
if: ${{ matrix.group == 'faq' }}
run: sudo apt-get install libpq-dev
- name: install graphviz
if: ${{ matrix.group == 'tutorial' || matrix.group == 'guide' || matrix.group == 'biology' }}
run: sudo apt-get -y install graphviz
- run: nox -s lint
if: ${{ matrix.group == 'tutorial' }} # choose a fast-running a group
- run: nox -s "install(group='${{ matrix.group }}')"
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: nox -s "build(group='${{ matrix.group }}')"
- name: upload coverage
uses: actions/upload-artifact@v2
with:
name: coverage--${{ matrix.group }}
path: .coverage
- name: upload docs
if: ${{ matrix.group == 'tutorial' || matrix.group == 'guide' || matrix.group == 'biology' || matrix.group == 'faq' || matrix.group == 'storage' }}
uses: actions/upload-artifact@v2
with:
name: docs-${{ matrix.group }}
path: ./docs/${{ matrix.group }}
docs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: checkout lndocs
uses: actions/checkout@v4
with:
repository: laminlabs/lndocs
ssh-key: ${{ secrets.READ_LNDOCS }}
path: lndocs
ref: main
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: ".github/workflows/build.yml"
- run: pip install -U laminci
- run: nox -s "install(group='docs')"
- uses: actions/download-artifact@v2
- run: nox -s docs
- uses: nwtgck/[email protected]
with:
publish-dir: "_build/html"
production-deploy: ${{ github.event_name == 'push' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
coverage:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: ".github/workflows/build.yml"
- run: |
pip install coverage[toml]
pip install --no-deps .
- uses: actions/download-artifact@v2
- name: run coverage
run: |
coverage combine coverage--*/.coverage*
coverage report --fail-under=0
coverage xml
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
dispatch:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.LAMIN_BUILD_DOCS }}
repository: "laminlabs/lamindb-dispatch"
event-type: build