-
-
Notifications
You must be signed in to change notification settings - Fork 30
230 lines (197 loc) · 8.17 KB
/
cron-conda.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
name: "Conda Update"
on:
schedule:
- cron: '0 10 * * 6' # everyday at 10am
push:
branches: [main, ]
jobs:
conda-update:
name: Update requirements.txt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install and Setup
run: |
set -x
python -m pip install -U pip setuptools wheel packaging
python -m pip install -e .[all]
#python -m pip install pathlib2 typing_extensions
- name: Setup Conda Distribution
run: |
export PCAPKIT_DEVMODE=1
export PCAPKIT_VERBOSE=1
python util/conda-dist.py
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
- name: Bump Version
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
python util/conda-build.py
- name: Commit Changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -am"Bumped build to $(cat conda/build)
Updated conda distribution at $(date). The following files have been changed:
${{ steps.verify-changed-files.outputs.changed_files }}"
- name: Push Changes
uses: ad-m/github-push-action@master
if: steps.verify-changed-files.outputs.files_changed == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Get Version
if: steps.verify-changed-files.outputs.files_changed == 'true'
id: get_version
run: |
set -ex
echo "PCAPKIT_VERSION=$(python -c 'import pcapkit; print(pcapkit.__version__)')" >> $GITHUB_OUTPUT
echo "PCAPKIT_CONDA_LABEL=$(python -c 'import pcapkit, pkg_resources; print("dev" if pkg_resources.parse_version(pcapkit.__version__).is_prerelease else "main")')" >> $GITHUB_OUTPUT
echo "PCAPKIT_BUILD=$(cat conda/build)" >> $GITHUB_OUTPUT
outputs:
CONDA_CHANGED: ${{ steps.verify-changed-files.outputs.files_changed }}
PCAPKIT_VERSION: ${{ steps.get_version.outputs.PCAPKIT_VERSION }}
PCAPKIT_CONDA_LABEL: ${{ steps.get_version.outputs.PCAPKIT_CONDA_LABEL }}
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }}
conda-tag:
name: Conda Tag
runs-on: ubuntu-latest
needs: [ conda-update ]
if: needs.conda-update.outputs.CONDA_CHANGED == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PYPCAPKIT }}
fetch-depth: 0
- name: Create Tag
run: |
set -x
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git pull
git tag "conda-${{ needs.conda-update.outputs.PCAPKIT_VERSION }}+${{ needs.conda-update.outputs.PCAPKIT_BUILD }}" -m"Conda Build"
- name: Push Tag
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PYPCAPKIT }}
atomic: false
tags: true
conda-dist:
name: Conda deployment of package for platform ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: [ conda-tag, conda-update ]
if: needs.conda-update.outputs.CONDA_CHANGED == 'true'
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
# - windows-latest # skip for now
python-version:
#- "3.7" # skip for now
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v4
with:
ref: conda-${{ needs.conda-update.outputs.PCAPKIT_VERSION }}+${{ needs.conda-update.outputs.PCAPKIT_BUILD }}
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install and Setup
if: ${{ matrix.os != 'windows-latest' }}
run: |
set -x
python -m pip install -U pip setuptools wheel
python -m pip install -e .[all]
python -m pip install pathlib2 typing_extensions
- name: Install and Setup (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -e .[all]
python -m pip install pathlib2 typing_extensions
- name: Setup Conda Distribution
if: ${{ matrix.os != 'windows-latest' }}
run: |
set -x
mkdir -p conda/wheels
python -m pip download -r conda/requirements.txt -d conda/wheels
- name: Setup Conda Distribution (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
mkdir -p conda/wheels
python -m pip download -r conda/requirements.txt -d conda/wheels
- name: Conda environment creation and activation
uses: conda-incubator/setup-miniconda@v3
env:
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }}
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }}
with:
python-version: ${{ matrix.python-version }}
environment-file: conda/conda-build.yaml # Path to the build conda environment
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true
- name: Build and upload the conda packages (macOS)
uses: uibcdf/[email protected]
if: ${{ matrix.os == 'macos-latest' }}
env:
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }}
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }}
with:
meta_yaml_dir: conda/pypcapkit
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix`
platform_osx-64: true
overwrite: true
user: jarryshaw
label: ${{ needs.conda-update.outputs.PCAPKIT_CONDA_LABEL }}
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret
- name: Build and upload the conda packages (Ubuntu)
uses: uibcdf/[email protected]
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }}
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }}
with:
meta_yaml_dir: conda/pypcapkit
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix`
platform_linux-64: true
overwrite: true
user: jarryshaw
label: ${{ needs.conda-update.outputs.PCAPKIT_CONDA_LABEL }}
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret
- name: Build and upload the conda packages (Windows)
uses: uibcdf/[email protected]
if: ${{ matrix.os == 'windows-latest' }}
env:
PCAPKIT_VERSION: ${{ needs.conda-update.outputs.PCAPKIT_VERSION }}
PCAPKIT_BUILD: ${{ needs.conda-update.outputs.PCAPKIT_BUILD }}
with:
meta_yaml_dir: conda/pypcapkit
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix`
platform_win-64: true
overwrite: true
user: jarryshaw
label: ${{ needs.conda-update.outputs.PCAPKIT_CONDA_LABEL }}
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret
- name: Upload package to GitHub Release
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: |
/tmp/compilation-*/**/*.tar.bz2
tag: "v${{ needs.conda-update.outputs.PCAPKIT_VERSION }}"
token: "${{ secrets.GITHUB_TOKEN }}"