Skip to content

Commit 309b8e8

Browse files
author
Andriy Brukhovetskyy
committed
pyproject
1 parent b5ec917 commit 309b8e8

File tree

4 files changed

+97
-33
lines changed

4 files changed

+97
-33
lines changed

.github/actions/action.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Python setup steps that can be reused'
2+
description: 'Install dependencies, poetry, requirements'
3+
inputs:
4+
python-version:
5+
required: true
6+
description: The python version
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Install dependencies
12+
if: ${{ runner.os == 'Linux' }}
13+
shell: bash
14+
run: |
15+
sudo apt update && sudo apt-get install -y --no-install-recommends libxml2-dev libxslt-dev python3-dev libgeoip-dev ssdeep libfuzzy-dev p7zip-full innoextract unrar upx
16+
17+
- name: Install poetry
18+
shell: bash
19+
run: pip install poetry
20+
21+
- name: Set up Python ${{ inputs.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ inputs.python-version }}
25+
cache: 'poetry'
26+
27+
- name: Install requirements
28+
shell: bash
29+
run: |
30+
poetry install --no-interaction --no-root
31+

.github/workflows/pythonpackage.yml

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
name: build
22

3-
on: [push, pull_request]
4-
53
jobs:
64
tester:
75
name: Test them all
@@ -28,3 +26,29 @@ jobs:
2826
run: |
2927
pip install pytest
3028
pytest
29+
30+
31+
name: Python package
32+
33+
env:
34+
COLUMNS: 132
35+
36+
on: [push, pull_request]
37+
38+
jobs:
39+
test:
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 20
42+
strategy:
43+
matrix:
44+
python-version: ["3.10", "3.11"]
45+
steps:
46+
- name: Check out repository code
47+
uses: actions/checkout@v4
48+
49+
- uses: ./.github/actions/python-setup/
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
53+
- name: Run unit tests
54+
run: poetry run python -m pytest --import-mode=append

poetry.lock

+29-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+11-6
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@ click = "*"
1515
cryptography = ">=2.1"
1616
olefile = ">=0.43"
1717
pefile = "*"
18-
python-magic-bin = {version = ">=0.4.14", markers = "sys_platform == 'win32'" }
19-
python-magic = {version = ">=0.4.13", markers = "sys_platform == 'linux'" }
18+
python-magic-bin = {version = ">=0.4.14", markers = "sys_platform == 'win32'", optional = true }
19+
python-magic = {version = ">=0.4.13", markers = "sys_platform == 'linux'", optional = true }
2020

21-
unicorn = {version = ">=2.0.0", extras = ["shellcode"] }
22-
yara-python = {version = ">=4.1.0", extras = ["shellcode"] }
21+
unicorn = {version = ">=2.0.0", extras = ["shellcode"], optional = true }
22+
yara-python = {version = ">=4.1.0", extras = ["shellcode"], optional = true }
2323

24-
mock = {version = ">=5.1.0", extras = ["dev"] }
25-
pytest = {version = ">=8.2.2", extras = ["dev"] }
24+
mock = {version = ">=5.1.0", extras = ["dev"], optional = true }
25+
pytest = {version = ">=8.2.2", extras = ["dev"], optional = true }
26+
27+
28+
[tool.poetry.extras]
29+
shellcode = ["unicorn", "yara-python"]
30+
dev = ["mock", "pytest"]
2631

2732
[tool.poetry.scripts]
2833
sflock = "sflock.main:main"

0 commit comments

Comments
 (0)