Skip to content

Commit

Permalink
Revamp CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
kigawas committed Jun 14, 2024
1 parent 4294856 commit 92d0e47
Show file tree
Hide file tree
Showing 13 changed files with 1,283 additions and 930 deletions.
15 changes: 13 additions & 2 deletions .cspell.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@
// language - current active spelling language
"language": "en",
// words - list of words to be always considered correct
"words": ["aes", "ecies", "eciespy", "fastapi", "secp256k1", "Spacefile", "uvicorn"],
"words": [
"aes",
"ecies",
"eciespy",
"fastapi",
"secp256k1",
"Spacefile",
"uvicorn",
"venv"
],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// For example "hte" should be "the"
"flagWords": ["hte"],
"flagWords": [
"hte"
],
"ignorePaths": [
".git",
".github",
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4

- run: pipx install poetry
- run: pipx inject poetry poetry-plugin-export

- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: abatilo/actions-poetry@v2.0.0
python-version: "3.12"
cache: "poetry"

- run: poetry export -f requirements.txt -o requirements.txt --without=dev

- uses: neobrains/space-pipe@v0.5
with:
poetry-version: 1.5.1
- run: poetry export -f requirements.txt -o requirements.txt --without-hashes
access_token: ${{ secrets.ACCESS_TOKEN }}
project_id: ${{ secrets.PROJECT_ID }}
space_release: true
22 changes: 16 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: abatilo/actions-poetry@v2.0.0
- uses: actions/checkout@v4

- run: pipx install poetry
- run: pipx inject poetry poetry-plugin-export

- uses: actions/setup-python@v5
with:
poetry-version: 1.5.1
python-version: "3.12"
cache: "poetry"

- run: poetry export -f requirements.txt -o requirements.txt --without=dev
- run: poetry install --only main

- uses: neobrains/space-pipe@v0.5
with:
access_token: ${{ secrets.ACCESS_TOKEN }}
project_id: ${{ secrets.PROJECT_ID }}
space_push: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ venv.bak/
.mypy_cache/

.space
requirements.txt
25 changes: 7 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
hooks:
- id: isort

- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
exclude: .venv
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.10.0
hooks:
- id: mypy
entry: mypy main.py
pass_filenames: false

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: check-yaml

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
# allow "imported but unused" for pre-commit, forbid it elsewhere e.g. in vscode
args: ["--config=setup.cfg", "--ignore=E501,E402,F401,E203,W503"]
7 changes: 7 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
line-length = 88

[lint]
ignore = ["E501", "W605", "E203"]

[lint.mccabe]
max-complexity = 12
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Weiliang Li
Copyright (c) 2018-2024 Weiliang Li

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A simple demo of [eciespy](https://github.com/ecies/py) based on FastAPI
## Example

```bash
curl -X POST https://eciespydemo-1-d5397785.deta.app/ \
curl -X POST https://demo.ecies.org/ \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'cache-control: no-cache' \
-d 'data=abc&pub=0x98afe4f150642cd05cc9d2fa36458ce0a58567daeaf5fde7333ba9b403011140a4e28911fcf83ab1f457a30b4959efc4b9306f514a4c3711a16a80e3b47eb58b'
Expand Down
1 change: 1 addition & 0 deletions Spacefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ micros:
engine: python3.9
primary: true
run: uvicorn main:app
dev: .venv/bin/uvicorn main:app --reload
public_routes:
- "/*"
1,736 changes: 1,213 additions & 523 deletions poetry.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ version = "0.1.0"
[tool.poetry.dependencies]
python = "^3.9"

eciespy = "^0.3.13"
eciespy = "^0.4.0"

# server
fastapi = "^0.110.3"
python-multipart = "^0.0.6"
uvicorn = "^0.22.0"
uvloop = "^0.17.0"
fastapi = "^0.111.0"
python-multipart = "^0.0.9"
uvicorn = "^0.30.0"
uvloop = "^0.19.0"

[tool.poetry.dev-dependencies]
black = "^23.3"
flake8 = "^6.0.0"
[tool.poetry.group.dev.dependencies]
mypy = "^1.4.1"
ruff = "^0.4.8"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down
Loading

0 comments on commit 92d0e47

Please sign in to comment.