forked from ibis-project/ibis
-
Notifications
You must be signed in to change notification settings - Fork 0
237 lines (205 loc) · 7.53 KB
/
conda-lock.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# vim: filetype=yaml
name: Generate Conda Lockfiles
on:
schedule:
# At minute 00:30 on Sunday
- cron: "30 0 * * SUN"
workflow_dispatch:
repository_dispatch:
types:
- condalock-command
jobs:
condalock:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
defaults:
run:
shell: bash -l {0}
steps:
- name: checkout
uses: actions/checkout@v3
with:
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
- uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
miniforge-version: latest
miniforge-variant: Mambaforge
activate-environment: conda-lock
python-version: ${{ matrix.python-version }}
condarc-file: ci/condarc
- name: install conda-lock
run: mamba install 'conda-lock <1.0'
- name: generate lock file
run: |
set -euo pipefail
python_version_file="$(mktemp --suffix=.yml)"
{
echo 'name: conda-lock'
echo 'dependencies:'
echo ' - python=${{ matrix.python-version }}'
} > "${python_version_file}"
template='conda-lock/{platform}-${{ matrix.python-version }}.lock'
conda lock \
--kind explicit \
--file pyproject.toml \
--file "${python_version_file}" \
--platform linux-64 \
--platform osx-64 \
--filename-template "${template}" \
--extras all \
--mamba
# not great, but conda-forge is missing packages for duckdb and
# clickhouse-cityhash for windows
conda lock \
--kind explicit \
--file pyproject.toml \
--file "${python_version_file}" \
--platform win-64 \
--filename-template "${template}" \
-e dask \
-e datafusion \
-e geospatial \
-e impala \
-e mysql \
-e pandas \
-e postgres \
-e pyspark \
-e sqlite \
-e visualization \
--mamba
- name: generate lock file for osx-arm64
continue-on-error: true
run: |
set -euo pipefail
python_version_file="$(mktemp --suffix=.yml)"
{
echo 'name: conda-lock'
echo 'dependencies:'
echo ' - python=${{ matrix.python-version }}'
} > "${python_version_file}"
template='conda-lock/{platform}-${{ matrix.python-version }}.lock'
conda lock \
--kind explicit \
--file pyproject.toml \
--file "${python_version_file}" \
--platform osx-arm64 \
--filename-template "${template}" \
-e dask \
-e datafusion \
-e geospatial \
-e mysql \
-e pandas \
-e postgres \
-e pyspark \
-e sqlite \
-e visualization \
--mamba
- name: create conda environment
run: mamba create --name ibis${{ matrix.python-version }} --file conda-lock/linux-64-${{ matrix.python-version }}.lock
- name: upload conda lock files
uses: actions/upload-artifact@v3
with:
name: conda-lock-files-${{ github.run_attempt }}
path: conda-lock/*-${{ matrix.python-version }}.lock
condalock_pr:
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs:
- condalock
steps:
- uses: tibdex/github-app-token@v1
id: generate_pr_token
with:
app_id: ${{ secrets.SQUAWK_BOT_APP_ID }}
private_key: ${{ secrets.SQUAWK_BOT_APP_PRIVATE_KEY }}
- uses: tibdex/github-app-token@v1
id: generate_pr_approval_token
with:
app_id: ${{ secrets.PR_APPROVAL_BOT_APP_ID }}
private_key: ${{ secrets.PR_APPROVAL_BOT_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
token: ${{ steps.generate_pr_token.outputs.token }}
- name: download conda lock files
uses: actions/download-artifact@v3
with:
name: conda-lock-files-${{ github.run_attempt }}
path: conda-lock
- uses: peter-evans/create-pull-request@v4
id: create_pr
with:
token: ${{ steps.generate_pr_token.outputs.token }}
commit-message: "chore(conda-lock): relock"
branch: "create-pull-request/conda-relock"
delete-branch: true
add-paths: conda-lock/*.lock
committer: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>"
author: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>"
title: "chore(conda-lock): relock"
body: "Relock conda-lock environment files"
labels: |
dependencies
autorebase:opt-in
- uses: juliangruber/approve-pull-request-action@v1.1.1
if: ${{ steps.create_pr.outputs.pull-request-operation == 'created' }}
with:
github-token: ${{ steps.generate_pr_approval_token.outputs.token }}
number: ${{ steps.create_pr.outputs.pull-request-number }}
- uses: peter-evans/enable-pull-request-automerge@v2
if: ${{ steps.create_pr.outputs.pull-request-operation == 'created' }}
with:
token: ${{ steps.generate_pr_token.outputs.token }}
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }}
merge-method: rebase
condalock_push:
if: ${{ github.event_name == 'repository_dispatch' }}
runs-on: ubuntu-latest
needs:
- condalock
steps:
- uses: tibdex/github-app-token@v1
id: generate_token
with:
app_id: ${{ secrets.SQUAWK_BOT_APP_ID }}
private_key: ${{ secrets.SQUAWK_BOT_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
token: ${{ steps.generate_token.outputs.token }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
- name: download conda lock files
uses: actions/download-artifact@v3
with:
name: conda-lock-files-${{ github.run_attempt }}
path: conda-lock
- name: Configure git info
run: |
set -euo pipefail
git config --global user.name 'ibis-squawk-bot[bot]'
git config --global user.email 'ibis-squawk-bot[bot]@users.noreply.github.com'
- name: commit lock files and push to PR
run: |
set -euo pipefail
git add conda-lock/*.lock
if git commit -m 'chore(conda-lock): relock'; then
# pull in case another commit happened in the meantime
#
# `ours` is actually the *other* changeset, not the current branch, per
# https://stackoverflow.com/a/3443225/564538
git pull --rebase -s recursive -X ours
git push
fi
- name: react on success
uses: peter-evans/create-or-update-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: hooray