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

ci: setup github actions #2

Merged
merged 2 commits into from
Oct 30, 2023
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
18 changes: 18 additions & 0 deletions .github/workflows/code-quality-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Code Quality Check

"on":
push:
branches:
- main
pull_request:
branches:
- main

jobs:
format:
name: Format and Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: chartboost/ruff-action@v1
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish
on:
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: pdm-project/setup-pdm@v3
with:
python-version: 3.9
cache: true
- name: Install dependencies
run: pdm install
- name: Run pytest
run: pdm run pytest
- name: Publish
run: pdm publish
24 changes: 24 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}
cache: true
- name: Install dependencies
run: pdm install
- name: Run pytest
run: pdm run pytest
3 changes: 3 additions & 0 deletions didcomm_messaging/multiformats/multibase.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,20 @@ def decode(self, value: str) -> bytes:

class Base64UrlEncoder(MultibaseEncoder):
"""Base64URL encoding."""

name = "base64url"
character = "u"

def encode(self, value: bytes) -> str:
"""Encode a byte string using the base64url encoding."""
import base64

return base64.urlsafe_b64encode(value).decode().rstrip("=")

def decode(self, value: str) -> bytes:
"""Decode a base64url encoded string."""
import base64

return base64.urlsafe_b64decode(value + "=" * (-len(value) % 4))


Expand Down