Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Oct 16, 2023
2 parents a98e9db + b8910b8 commit 2485b73
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
codecov:
require_ci_to_pass: true
comment:
require_changes: true
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
contents: read
steps:
-
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Set up Python 3.10
uses: actions/setup-python@v4
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:

steps:
-
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Start containers
run: |
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- lint
steps:
-
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Set up Python 3.10
uses: actions/setup-python@v4
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
- test
steps:
-
uses: actions/checkout@v3
uses: actions/checkout@v4
-
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -175,4 +175,4 @@ jobs:
path: dist
-
name: Publish build to PyPI
uses: pypa/[email protected].8
uses: pypa/[email protected].10
88 changes: 88 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches:
- "main"
- "develop"
- "feature/**"
- "fix/**"
pull_request:
# The branches below must be a subset of the branches above
branches:
- "main"
- "develop"
schedule:
- cron: '43 10 * * 1'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.0] - 2023-10-16

### Added

- CodeQL scanning via GitHub
- Codecov.io coverage shield

### Changed

- Updated pypa/gh-action-pypi-publish from 1.8.8 to 1.8.10
- Updated actions/checkout from 3 to 4
- Mis-spelled `gotenerg_url` for a `Client` is now `host` and no longer keyword only

## [0.1.0] - 2023-10-15

### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![PyPI - Version](https://img.shields.io/pypi/v/gotenberg-client.svg)](https://pypi.org/project/gotenberg-client)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/gotenberg-client.svg)](https://pypi.org/project/gotenberg-client)
[![codecov](https://codecov.io/gh/stumpylog/gotenberg-client/graph/badge.svg?token=PH25G91Q6J)](https://codecov.io/gh/stumpylog/gotenberg-client)

---

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies = [

[tool.hatch.envs.default.scripts]
version = "python3 --version"
pip-list = "pip list"
test = "pytest --pythonwarnings=all {args:tests}"
test-cov = "coverage run -m pytest --pythonwarnings=all {args:tests}"
cov-clear = "coverage erase"
Expand All @@ -76,13 +77,13 @@ cov-html = "coverage html"
cov-json = "coverage json"
cov = [
"version",
"pip-list",
"cov-clear",
"test-cov",
"cov-report",
"cov-json",
"cov-html"
]
pip-list = "pip list"

[[tool.hatch.envs.all.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
Expand Down
2 changes: 1 addition & 1 deletion src/gotenberg_client/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Trenton H <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0
__version__ = "0.1.0"
__version__ = "0.2.0"
4 changes: 2 additions & 2 deletions src/gotenberg_client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class GotenbergClient:

def __init__(
self,
host: str,
*,
gotenerg_url: str,
timeout: float = 30.0,
log_level: int = logging.ERROR,
http2: bool = True,
):
# Configure the client
self._client = Client(base_url=gotenerg_url, timeout=timeout, http2=http2)
self._client = Client(base_url=host, timeout=timeout, http2=http2)

# Set the log level
logging.getLogger("httpx").setLevel(log_level)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

@pytest.fixture()
def client() -> GotenbergClient:
with GotenbergClient(gotenerg_url=GOTENBERG_URL, log_level=logging.INFO) as client:
with GotenbergClient(host=GOTENBERG_URL, log_level=logging.INFO) as client:
yield client
5 changes: 3 additions & 2 deletions tests/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from tests.conftest import SAMPLE_DIR
from tests.conftest import SAVE_DIR
from tests.conftest import SAVE_OUTPUTS
from tests.utils import call_run_with_server_error_handling


@pytest.fixture()
Expand Down Expand Up @@ -41,7 +42,7 @@ def test_merge_files_pdf_a(
pike_format: str,
):
with client.merge.merge() as route:
resp = route.merge(create_files).pdf_format(gt_format).run()
resp = call_run_with_server_error_handling(route.merge(create_files).pdf_format(gt_format))

assert resp.status_code == codes.OK
assert "Content-Type" in resp.headers
Expand All @@ -63,7 +64,7 @@ def test_pdf_a_multiple_file(
create_files: List[Path],
):
with client.merge.merge() as route:
resp = route.merge(create_files).run()
resp = call_run_with_server_error_handling(route.merge(create_files))

assert resp.status_code == codes.OK
assert "Content-Type" in resp.headers
Expand Down

0 comments on commit 2485b73

Please sign in to comment.