Skip to content

Commit 04baa4d

Browse files
committed
revised conda build process
1 parent 3620197 commit 04baa4d

17 files changed

+356
-59
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ indent_style = tab
1919

2020
[*.rst]
2121
indent_size = 3
22+
23+
[conda/build]
24+
insert_final_newline = false
25+
26+
[requirements.txt]
27+
indent_size = 2

.github/workflows/create-release.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ jobs:
160160
conda:
161161
name: Conda deployment of package with Python ${{ matrix.python-version }}
162162
runs-on: ubuntu-latest
163-
needs: [ version_check ]
163+
needs: [ github, version_check ]
164164
if: ${{ startsWith(github.ref_name, 'v') || needs.version_check.outputs.PCAPKIT_TAG_EXISTS == 'false' }}
165165
strategy:
166166
matrix:
@@ -170,13 +170,21 @@ jobs:
170170
with:
171171
fetch-depth: 0
172172

173+
- name: Get Build Version
174+
id: get_version
175+
run: |
176+
set -x
177+
178+
echo "PCAPKIT_BUILD=$(cat conda/build)" >> $GITHUB_OUTPUT
179+
173180
- name: Conda environment creation and activation
174181
uses: conda-incubator/setup-miniconda@v2
175182
env:
176183
PCAPKIT_VERSION: ${{ needs.version_check.outputs.PCAPKIT_VERSION }}
184+
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }}
177185
with:
178186
python-version: ${{ matrix.python-version }}
179-
environment-file: util/conda-build.yaml # Path to the build conda environment
187+
environment-file: conda/conda-build.yaml # Path to the build conda environment
180188
auto-update-conda: false
181189
auto-activate-base: false
182190
show-channel-urls: true
@@ -185,12 +193,20 @@ jobs:
185193
uses: uibcdf/action-build-and-upload-conda-packages@v1.2.0
186194
env:
187195
PCAPKIT_VERSION: ${{ needs.version_check.outputs.PCAPKIT_VERSION }}
196+
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }}
188197
with:
189-
meta_yaml_dir: .
198+
meta_yaml_dir: conda/pypcapkit
190199
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix`
191-
platform_linux-64: true
192-
platform_osx-64: true
193-
platform_win-64: true
200+
platform_all: true
194201
user: jarryshaw
195202
label: ${{ needs.version_check.outputs.PCAPKIT_CONDA_LABEL }}
196203
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret
204+
205+
- name: Upload package to GitHub Release
206+
uses: ncipollo/release-action@v1.12.0
207+
with:
208+
allowUpdates: true
209+
artifacts: |
210+
/tmp/compilation-*/*.tar.bz2
211+
tag: "v${{ needs.version_check.outputs.PCAPKIT_VERSION }}"
212+
token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/cron-conda.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: "Conda Update"
2+
3+
on:
4+
schedule:
5+
- cron: '0 10 * * 6' # everyday at 10am
6+
push:
7+
branches: [main, ]
8+
9+
jobs:
10+
conda-update:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version:
15+
- "3.7"
16+
- "3.8"
17+
- "3.9"
18+
- "3.10"
19+
- "3.11"
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- uses: actions/setup-python@v4
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install and Setup
30+
run: |
31+
python -m pip install -U pip setuptools wheel
32+
python -m pip install -e .[all]
33+
python -m pip install pathlib2 typing_extensions
34+
35+
- name: Setup Conda Distribution
36+
run: |
37+
python util/conda-dist.py
38+
39+
- name: Verify Changed files
40+
uses: tj-actions/verify-changed-files@v14
41+
id: verify-changed-files
42+
43+
- name: Bump Version
44+
if: steps.verify-changed-files.outputs.files_changed == 'true'
45+
run: |
46+
python util/conda-build.py
47+
48+
- name: Commit Changes
49+
if: steps.verify-changed-files.outputs.files_changed == 'true'
50+
run: |
51+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
52+
git config --local user.name "github-actions[bot]"
53+
git commit -am"Bumped build to $(cat conda/build)')
54+
55+
Updated conda distribution at $(date). The following files have been changed:
56+
${{ steps.verify-changed-files.outputs.changed_files }}"
57+
58+
- name: Push Changes
59+
uses: ad-m/github-push-action@master
60+
if: steps.verify-changed-files.outputs.files_changed == 'true'
61+
with:
62+
github_token: ${{ secrets.GITHUB_TOKEN }}
63+
branch: ${{ github.ref }}
64+
65+
- name: Get Version
66+
if: steps.verify-changed-files.outputs.files_changed == 'true'
67+
id: get_version
68+
run: |
69+
set -ex
70+
71+
echo "PCAPKIT_VERSION=$(python -c 'import pcapkit; print(pcapkit.__version__)')" >> $GITHUB_OUTPUT
72+
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
73+
echo "PCAPKIT_BUILD=$(cat conda/build)" >> $GITHUB_OUTPUT
74+
75+
- name: Create Tag
76+
uses: rickstaa/action-create-tag@v1
77+
if: steps.verify-changed-files.outputs.files_changed == 'true'
78+
with:
79+
tag: "conda-${{ steps.get_version.outputs.PCAPKIT_VERSION }}+${{ steps.get_version.outputs.PCAPKIT_BUILD }}"
80+
81+
- name: Conda environment creation and activation
82+
if: steps.verify-changed-files.outputs.files_changed == 'true'
83+
uses: conda-incubator/setup-miniconda@v2
84+
env:
85+
PCAPKIT_VERSION: ${{ steps.get_version.outputs.PCAPKIT_VERSION }}
86+
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }}
87+
with:
88+
python-version: ${{ matrix.python-version }}
89+
environment-file: conda/conda-build.yaml # Path to the build conda environment
90+
auto-update-conda: false
91+
auto-activate-base: false
92+
show-channel-urls: true
93+
94+
- name: Build and upload the conda packages
95+
if: steps.verify-changed-files.outputs.files_changed == 'true'
96+
uses: uibcdf/action-build-and-upload-conda-packages@v1.2.0
97+
env:
98+
PCAPKIT_VERSION: ${{ steps.get_version.outputs.PCAPKIT_VERSION }}
99+
PCAPKIT_BUILD: ${{ steps.get_version.outputs.PCAPKIT_BUILD }}
100+
with:
101+
meta_yaml_dir: conda/pypcapkit
102+
python-version: ${{ matrix.python-version }} # Values previously defined in `matrix`
103+
platform_all: true
104+
user: jarryshaw
105+
label: main
106+
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret
107+
108+
- name: Upload package to GitHub Release
109+
if: steps.verify-changed-files.outputs.files_changed == 'true'
110+
uses: ncipollo/release-action@v1.12.0
111+
with:
112+
allowUpdates: true
113+
artifacts: |
114+
/tmp/compilation-*/*.tar.bz2
115+
tag: "v${{ steps.get_version.outputs.PCAPKIT_VERSION }}"
116+
token: "${{ secrets.GITHUB_TOKEN }}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ release
2727

2828
/VERSION
2929

30+
pcapkit/_extern
31+
3032
# Created by https://www.gitignore.io/api/macos,python,visualstudiocode
3133

3234
### macOS ###

.pyup.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# autogenerated pyup.io config file
1+
# autogenerated pyup.io config file
22
# see https://pyup.io/docs/configuration/ for all available options
33

44
schedule: every week
5+
6+
requirements:
7+
- docs/requirements.txt
8+
- conda/requirements.txt
9+
update: False

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"ccecho",
2424
"ccnew",
2525
"cdat",
26+
"certifi",
2627
"cflg",
2728
"chkreq",
2829
"Chksum",
@@ -136,6 +137,7 @@
136137
"hwty",
137138
"Iaddr",
138139
"iden",
140+
"idna",
139141
"idnm",
140142
"ifdrop",
141143
"ifext",
@@ -167,6 +169,7 @@
167169
"locl",
168170
"loct",
169171
"lrfc",
172+
"lxml",
170173
"maca",
171174
"magn",
172175
"maxt",

conda/build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0
File renamed without changes.

conda/pypcapkit/meta.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{% set name = "pypcapkit" %}
2+
{% set version = environ['PCAPKIT_VERSION'] %}
3+
{% set build_number = environ['PCAPKIT_BUILD'] %}
4+
5+
package:
6+
name: "{{ name|lower }}"
7+
version: "{{ version }}"
8+
9+
source:
10+
git_url: https://github.com/JarryShaw/PyPCAPKit.git
11+
git_rev: "conda-{{ version }}+{{ build_number }}"
12+
git_depth: 1 # (Defaults to -1/not shallow)
13+
14+
build:
15+
number: {{ build_number }}
16+
entry_points:
17+
- pcapkit-cli = pcapkit.__main__:main
18+
- pcapkit-vendor = pcapkit.vendor.__main__:main
19+
script: "{{ PYTHON }} -m pip install . -vv"
20+
21+
requirements:
22+
build:
23+
- git
24+
- python
25+
- pip
26+
- setuptools>=61.0.0
27+
28+
# # version compatibility
29+
# - bpc-f2format
30+
# - bpc-poseur
31+
# - bpc-walrus
32+
33+
# - dictdumper~=0.8.0 # for formatted output
34+
# - chardet # for bytes decode
35+
# - aenum # for const types
36+
# - tbtrim>=0.2.1 # for refined exceptions
37+
38+
# # version compatibility
39+
# - pathlib2>=2.3.2
40+
# - typing-extensions
41+
42+
# - emoji
43+
# - dpkt
44+
# - scapy
45+
# - pyshark
46+
# - requests[socks]
47+
# - beautifulsoup4[html5lib]
48+
host:
49+
- python
50+
- pip
51+
- setuptools>=61.0.0
52+
53+
# # version compatibility
54+
# - bpc-f2format
55+
# - bpc-poseur
56+
# - bpc-walrus
57+
58+
# - dictdumper~=0.8.0 # for formatted output
59+
# - chardet # for bytes decode
60+
# - aenum # for const types
61+
# - tbtrim>=0.2.1 # for refined exceptions
62+
63+
# # version compatibility
64+
# - pathlib2>=2.3.2
65+
# - typing-extensions
66+
67+
# - emoji
68+
# - dpkt
69+
# - scapy
70+
# - pyshark
71+
# - requests[socks]
72+
# - beautifulsoup4[html5lib]
73+
run:
74+
- python
75+
76+
# - dictdumper~=0.8.0 # for formatted output
77+
# - chardet # for bytes decode
78+
# - aenum # for const types
79+
# - tbtrim>=0.2.1 # for refined exceptions
80+
81+
# # version compatibility
82+
# - pathlib2>=2.3.2
83+
# - typing-extensions
84+
85+
# - emoji
86+
# - dpkt
87+
# - scapy
88+
# - pyshark
89+
# - requests[socks]
90+
# - beautifulsoup4[html5lib]
91+
92+
test:
93+
imports:
94+
- pcapkit
95+
96+
about:
97+
home: https://jarryshaw.github.io/PyPCAPKit
98+
license: BSD 3-Clause License
99+
license_family: BSD
100+
license_file:
101+
- LICENSE
102+
summary: "PyPCAPKit: comprehensive network packet analysis library"
103+
doc_url: https://jarryshaw.github.io/PyPCAPKit
104+
dev_url: https://github.com/jarryshaw/pypcapkit
105+
106+
extra:
107+
recipe-maintainers:
108+
- jarryshaw

conda/requirements.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
dictdumper==0.8.4.post2
2+
3+
chardet==5.1.0
4+
aenum==3.1.12
5+
tbtrim==0.3.1
6+
7+
emoji==2.2.0
8+
dpkt==1.9.8
9+
scapy==2.5.0
10+
pyshark==0.6
11+
appdirs==1.4.4
12+
lxml==4.9.2
13+
packaging==23.1
14+
termcolor==2.3.0
15+
16+
requests==2.30.0
17+
certifi==2023.5.7
18+
charset-normalizer==3.1.0
19+
idna==3.4
20+
urllib3==2.0.2
21+
PySocks==1.7.1
22+
23+
beautifulsoup4==4.12.2
24+
soupsieve==2.4.1
25+
html5lib==1.1
26+
six==1.16.0
27+
webencodings==0.5.1
28+
29+
pathlib2==2.3.7.post1
30+
typing_extensions==4.6.3

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ sphinx-copybutton
88

99
# auxiliary
1010
typing-extensions
11+
mypy-extensions

0 commit comments

Comments
 (0)