Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change github action #7

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
per-file-ignores =
*/__init__.py:F401
exclude = ['.git', '__pycache__', 'docs/source/conf.py', 'old', 'build', 'dist']
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,.venv
max-line-length = 120
count = true
35 changes: 24 additions & 11 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,29 @@ on:
branches: [ "main" ]

jobs:
build:
pep8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Python dependencies
run: |
python -m pip install poetry
poetry install --sync --with dev
- name: Lint with flake8
run: |
poetry run flake8 . --count
test:
needs: pep8
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
os: [ubuntu-latest, macos-latest]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v4
Expand All @@ -33,26 +46,26 @@ jobs:
cd GmSSL && git checkout tags/v3.1.1
mkdir build && cd build && cmake ..
make && make test && sudo make install
sudo ldconfig
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo ldconfig
elif [[ "$OSTYPE" == "darwin"* ]]; then
sudo update_dyld_shared_cache
fi
gmssl version
cd ../../
- name: Install Python dependencies
run: |
python -m pip install poetry
poetry install --sync --with dev
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 ./src --count --exit-zero
- name: Test with pytest
run: |
poetry run pytest --cov=src/pygmssl --cov-report=xml
poetry run pytest --cov=src --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
env_vars: OS,PYTHON
fail_ci_if_error: true # optional (default = false)
flags: unittests
name: codecov-umbrella # optional
name: codecov-umbrella-python${{ matrix.python-version }}-${{ matrix.os }} # optional
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)
60 changes: 23 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,47 +1,22 @@
[project]
[tool.poetry]
name = "pygmssl"
dynamic = ["version"]
authors = [{ name = "Zhang Jie", email = "[email protected]" }]
description = "A Python ctypes GmSSL implementation"
version = "0.1.0"
description = "A Python ctypes implementation of GmSSLv3.1.1"
license = "MIT"
authors = ["Zhang Jie <[email protected]>"]
maintainers = ["Zhang Jie <[email protected]>"]
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["pycryptodomex>=3.17"]
keywords=["国密", "SM2", "SM3", "SM4"]
homepage = "https://github.com/j-z10/pygmssl"
keywords=["国密", "GmSSL", "gmssl", "sm2", "sm3", "sm4"]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/jz10ujs/pygmssl"
"Bug Tracker" = "https://github.com/jz10ujs/pygmssl/issues"

[tool.setuptools]
packages = ["pygmssl"]

[tool.setuptools.dynamic]
version = {attr = "pygmssl.VERSION"}

[tool.autopep8]
indent_size = 4
max_line_length = 120
ignore = ["E121", "W6"]
aggressive = 3
# in-place = true
# recursive = true

[tool.isort]
max_line_length = 120

[tool.poetry]
name = "pygmssl"
version = "0.1.0"
description = "GmSSL in python ctypes"
authors = ["Zhang Jie <[email protected]>"]
license = "GPLv3"
readme = "README.md"
packages = [
{ include = "pygmssl", from = "src" },
]

[tool.poetry.dependencies]
python = "^3.11"
Expand All @@ -57,3 +32,14 @@ pytest-cov = "^5.0.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.autopep8]
indent_size = 4
max_line_length = 120
ignore = ["E121", "W6"]
aggressive = 3
# in-place = true
# recursive = true

[tool.isort]
max_line_length = 120
Empty file added src/pygmssl/py.typed
Empty file.