forked from LiberTEM/LiberTEM
-
Notifications
You must be signed in to change notification settings - Fork 0
199 lines (190 loc) · 7.46 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: CI
on:
push:
branches:
- master
- 'v[0-9]*'
tags:
- 'v[0-9]*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
tests:
strategy:
matrix:
python_version: ["3.7", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Choose Python version ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
python-version: '${{ matrix.python_version }}'
cache: 'pip'
- run: |
[[ "${{ matrix.os }}" = "ubuntu-latest" ]] && sudo apt-get install -y libcap-dev || true
shell: bash
- name: install tox
run: python3 -m pip install tox
- name: run tox
run: tox -e 'py${{ matrix.python_version }}'
- name: submit code coverage
uses: codecov/codecov-action@v3
node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: client/package-lock.json
- run: (cd client && npm ci)
- run: (cd client && npm run build)
- run: (cd client && CI=1 npm run coverage)
- run: (cd client && npm run lint)
- name: submit code coverage
uses: codecov/codecov-action@v3
additional:
strategy:
matrix:
envs: ["numba_coverage", "docs-check", "web_api"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Choose Python version 3.11'
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- run: sudo apt-get install -y pandoc libcap-dev graphviz
- name: install tox
run: python3 -m pip install tox
- name: 'run tox for environment ${{ matrix.envs }}'
run: tox -e '${{ matrix.envs }}'
- name: submit code coverage
uses: codecov/codecov-action@v3
build-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Choose Python version 3.11'
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: install dependencies
run: python3 -m pip install pip-tools
- name: generate requirements.txt
run: cd packaging/docker && ./update_reqs.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull cache base image
run: |
docker pull python:3.11-slim # the base image, to make sure we get the latest one
docker pull ghcr.io/libertem/libertem-dev:latest
- name: Build and push (libertem/libertem-triage)
uses: docker/build-push-action@v4
with:
file: packaging/docker/Dockerfile
context: .
push: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/v') || github.ref == 'refs/heads/master' }}
tags: ghcr.io/libertem/libertem-triage:pre-${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/libertem/libertem-dev:latest
cache-to: type=inline
- name: Build and push (libertem/libertem-dev)
uses: docker/build-push-action@v4
with:
file: packaging/docker/Dockerfile
context: .
push: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/v') || github.ref == 'refs/heads/master' }}
tags: ghcr.io/libertem/libertem-dev:pre-${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/libertem/libertem-dev:latest
cache-to: type=inline
build-args: |
dev=1
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Choose Python version 3.11'
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- run: sudo apt-get install -y pandoc
- name: install tox
run: python3 -m pip install tox
- name: 'run tox for docs-build-ci'
run: tox -e 'docs-build-ci'
- uses: actions/upload-pages-artifact@v1.0.8
with:
path: 'docs/build/html/'
deploy-docs:
runs-on: ubuntu-latest
needs: [build-docs, additional, tests, node, build-docker-image]
if: github.ref == 'refs/heads/master'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
- run: |
curl -XPOST -u "sk1p:${{secrets.PAGES_TRIGGER_GH_TOKEN}}" -H "Accept: application/vnd.github.everest-preview+json" -H 'Content-Type: application/json' https://api.github.com/repos/LiberTEM/libertem.github.io/dispatches --data '{"event_type":"build_pages","client_payload":{"from":"LiberTEM"}}'
release:
runs-on: ubuntu-latest
needs: [build-docs, additional, tests, node, build-docker-image]
# master branch, stable branches or release tags:
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/v') || github.ref == 'refs/heads/master'
env:
LT_RELEASE_UPLOAD_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LT_RELEASE_UPLOAD_PYPI_TEST_PASSWORD: ${{ secrets.LT_RELEASE_UPLOAD_PYPI_TEST_PASSWORD }}
LT_RELEASE_UPLOAD_PYPI_PASSWORD: ${{ secrets.LT_RELEASE_UPLOAD_PYPI_PASSWORD }}
LT_RELEASE_UPLOAD_ZENODO_SANDBOX_TOKEN: ${{ secrets.LT_RELEASE_UPLOAD_ZENODO_SANDBOX_TOKEN }}
LT_RELEASE_UPLOAD_ZENODO_TOKEN: ${{ secrets.LT_RELEASE_UPLOAD_ZENODO_TOKEN }}
LT_RELEASE_UPLOAD_ZENODO_SANDBOX_PARENT: ${{ secrets.LT_RELEASE_UPLOAD_ZENODO_SANDBOX_PARENT }}
LT_RELEASE_UPLOAD_ZENODO_PARENT: ${{ secrets.LT_RELEASE_UPLOAD_ZENODO_PARENT }}
steps:
- run: sudo apt-get install -y fuse
- uses: actions/checkout@v3
- name: Choose Python version 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
- name: install release script deps
run: pip install -r scripts/requirements.txt
- name: release status
run: ./scripts/release status
- name: run release script
run: ./scripts/release --verbose upload --no-dry-run --pypi-user __token__ --pypi-test-user __token__ --build-appimage
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull docker images from build stage
run: |
docker pull ghcr.io/libertem/libertem-triage:pre-${{ github.sha }}
docker pull ghcr.io/libertem/libertem-dev:pre-${{ github.sha }}
- name: Push images to GHCR
run: |
./scripts/release docker-retag ghcr.io/libertem/libertem-triage:pre-${{ github.sha }} ghcr.io/libertem/libertem
docker buildx imagetools create --tag ghcr.io/libertem/libertem-dev:latest ghcr.io/libertem/libertem-dev:pre-${{ github.sha }}