Skip to content

Commit 364490e

Browse files
committed
feature/#1 - Initial project setup with CI/CD, documentation, and build scripts
1 parent deb0639 commit 364490e

10 files changed

Lines changed: 536 additions & 190 deletions

File tree

.flake8

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[flake8]
2+
max-line-length = 100
3+
exclude =
4+
.git,
5+
__pycache__,
6+
build,
7+
dist,
8+
*.egg-info,
9+
.venv,
10+
.tox,
11+
.pytest_cache
12+
statistics = True
13+
count = True
14+
show-source = True

.github/dependabot.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
open-pull-requests-limit: 5
8+
target-branch: "main"
9+
labels:
10+
- "security"
11+
- "dependencies"
12+
commit-message:
13+
prefix: "security"
14+
include: "scope"
15+
reviewers:
16+
- "garotm"
17+
assignees:
18+
- "garotm"
19+
versioning-strategy:
20+
increase-if-necessary: true
21+
allow:
22+
- dependency-type: "direct"
23+
ignore:
24+
- dependency-name: "*"
25+
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
26+
security-updates-only: true
27+
28+
- package-ecosystem: "github-actions"
29+
directory: "/"
30+
schedule:
31+
interval: "monthly"
32+
open-pull-requests-limit: 3
33+
labels:
34+
- "security"
35+
- "github-actions"
36+
commit-message:
37+
prefix: "security"
38+
include: "scope"
39+
ignore:
40+
- dependency-name: "*"
41+
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
42+
security-updates-only: true

.github/workflows/sonarcloud.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: SonarCloud Analysis
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
workflow_dispatch:
9+
10+
jobs:
11+
sonarcloud:
12+
name: SonarCloud
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements.txt
29+
pip install pytest pytest-cov
30+
31+
- name: Run tests with coverage
32+
run: |
33+
pytest tests/ --cov=githubauthlib --cov-report=xml --cov-report=term-missing
34+
35+
- name: SonarCloud Scan
36+
uses: SonarSource/sonarcloud-github-action@master
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40+
with:
41+
args: >
42+
-Dsonar.organization=flexrpl
43+
-Dsonar.projectKey=fleXRPL_githubauthlib
44+
-Dsonar.python.coverage.reportPaths=coverage.xml
45+
-Dsonar.sources=githubauthlib
46+
-Dsonar.tests=tests
47+
-Dsonar.python.version=3
48+
-Dsonar.sourceEncoding=UTF-8
49+
-Dsonar.exclusions=docs/**,scripts/**
50+
-Dsonar.coverage.exclusions=tests/**,docs/**,scripts/**
51+
-Dsonar.python.xunit.reportPath=test-results.xml

.github/workflows/workflow.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: workflow
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
test:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
pip install black isort flake8 pytest pytest-cov
29+
- name: Run tests and linting
30+
run: |
31+
black --check githubauthlib tests
32+
isort --check githubauthlib tests
33+
flake8 githubauthlib tests
34+
pytest tests/ --cov=githubauthlib --cov-report=xml --cov-fail-under=90
35+
36+
publish:
37+
needs: test
38+
if: startsWith(github.ref, 'refs/tags/v')
39+
runs-on: ubuntu-latest
40+
environment: pypi
41+
permissions:
42+
id-token: write
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: Set up Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: '3.12'
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install build
54+
- name: Build package
55+
run: python -m build
56+
- name: Publish to PyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# GitHub Authentication Library (githubauthlib)
22

3+
[![PyPI version](https://badge.fury.io/py/githubauthlib.svg)](https://pypi.org/project/githubauthlib/)
4+
[![Python](https://img.shields.io/pypi/pyversions/githubauthlib.svg)](https://pypi.org/project/githubauthlib/)
5+
[![Tests](https://github.com/fleXRPL/githubauthlib/actions/workflows/tests.yml/badge.svg)](https://github.com/fleXRPL/githubauthlib/actions/workflows/tests.yml)
6+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fleXRPL_githubauthlib&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=fleXRPL_githubauthlib)
7+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=fleXRPL_githubauthlib&metric=coverage)](https://sonarcloud.io/summary/new_code?id=fleXRPL_githubauthlib)
8+
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=fleXRPL_githubauthlib&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=fleXRPL_githubauthlib)
9+
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=fleXRPL_githubauthlib&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=fleXRPL_githubauthlib)
10+
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=fleXRPL_githubauthlib&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=fleXRPL_githubauthlib)
11+
[![Dependabot Status](https://img.shields.io/badge/Dependabot-enabled-success.svg)](https://github.com/fleXRPL/githubauthlib/blob/main/.github/dependabot.yml)
12+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14+
[![Security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
15+
[![Downloads](https://pepy.tech/badge/githubauthlib)](https://pepy.tech/project/githubauthlib)
16+
317
A Python library for securely retrieving GitHub tokens from system keychains across different operating systems.
418

519
## Features

githubauthlib/__init__.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
from various system-specific secure storage solutions.
66
"""
77

8-
from .github_auth import (
9-
get_github_token,
10-
GitHubAuthError,
11-
CredentialHelperError,
12-
UnsupportedPlatformError
13-
)
8+
from .github_auth import get_github_token
149

15-
__version__ = '1.0.0'
16-
__author__ = 'garotm'
17-
__license__ = 'MIT'
10+
__version__ = "1.0.0"
11+
__author__ = "garotm"
12+
__license__ = "MIT"
13+
14+
__all__ = ["get_github_token"]

0 commit comments

Comments
 (0)