Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Oct 16, 2023
2 parents b9f602f + 7938323 commit a98e9db
Show file tree
Hide file tree
Showing 50 changed files with 2,414 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .docker/docker-compose.ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# docker-compose file for running testing with gotenberg container
# Can be used locally or by the CI to start the nessecary container with the
# correct networking for the tests

version: "3"
services:
gotenberg:
image: docker.io/gotenberg/gotenberg:7.9.2
hostname: gotenberg
container_name: gotenberg
network_mode: host
restart: unless-stopped
37 changes: 37 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# EditorConfig: http://EditorConfig.org

root = true

[*]
indent_style = tab
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8
max_line_length = 88

[{*.html,*.css,*.js}]
max_line_length = off

[*.py]
indent_size = 4
indent_style = space

[*.{yml,yaml}]
indent_style = space

[*.rst]
indent_style = space

[*.md]
indent_style = space

# Tests don't get a line width restriction. It's still a good idea to follow
# the 79 character rule, but in the interests of clarity, tests often need to
# violate it.
[**/test_*.py]
max_line_length = off

[*.toml*]
indent_style = space
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#package-ecosystem

version: 2
updates:

# Enable version updates for Python
- package-ecosystem: "pip"
target-branch: "develop"
# Look for a `Pipfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"
labels:
- "dependencies"

# Enable updates for Github Actions
- package-ecosystem: "github-actions"
target-branch: "develop"
directory: "/"
schedule:
# Check for updates to GitHub Actions every month
interval: "monthly"
labels:
- "dependencies"
178 changes: 178 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
name: ci

on:
push:
pull_request:
branches:
- main
- develop

concurrency:
group: test-${{ github.ref_name }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
-
uses: actions/checkout@v3
-
name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
-
name: Install Hatch
run: |
pip3 --quiet install --upgrade hatch
-
name: Lint project
run: |
hatch run lint:all
-
name: Check files with pre-commit
uses: pre-commit/[email protected]
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- lint
strategy:
fail-fast: false
matrix:
# No pikepdf wheels for pypy3.8
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9']

steps:
-
uses: actions/checkout@v3
-
name: Start containers
run: |
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml pull --quiet
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml up --detach
echo "Wait for container to be started"
sleep 5
-
name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
-
name: Install Hatch
run: pip install --upgrade hatch
-
name: Run tests
run: hatch run cov
-
name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
with:
# not required for public repos, but intermittently fails otherwise
token: ${{ secrets.CODECOV_TOKEN }}
-
name: Stop containers
if: always()
run: |
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml logs
docker compose --file ${GITHUB_WORKSPACE}/.docker/docker-compose.ci-test.yml down
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- lint
steps:
-
uses: actions/checkout@v3
-
name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
-
name: Install Hatch
run: |
pip3 --quiet install --upgrade hatch
-
name: Build
run: |
hatch build --clean
-
uses: actions/upload-artifact@v3
with:
name: artifacts
path: dist/*
if-no-files-found: error
retention-days: 7

create-release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
needs:
- build
- test
steps:
-
uses: actions/checkout@v3
-
uses: actions/download-artifact@v3
with:
name: artifacts
path: dist
-
name: Get latest release info
id: query-release-info
uses: release-flow/keep-a-changelog-action@v2
with:
command: query
version: ${{ github.ref_name }}
-
name: Display release info
run: |
echo "Version: ${{ steps.query-release-info.outputs.version }}"
echo "Date: ${{ steps.query-release-info.outputs.release-date }}"
echo "${{ steps.query-release-info.outputs.release-notes }}"
-
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.tar.gz,dist/*.whl"
body: ${{ steps.query-release-info.outputs.release-notes }}

pypi-publish:
name: Publish
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
needs:
- build
- test
steps:
-
uses: actions/download-artifact@v3
with:
name: artifacts
path: dist
-
name: Publish build to PyPI
uses: pypa/[email protected]
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
coverage.json

# Translations
*.mo
Expand Down Expand Up @@ -158,3 +159,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

tests/outputs/**
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This file configures pre-commit hooks.
# See https://pre-commit.com/ for general information
# See https://pre-commit.com/hooks.html for a listing of possible hooks

repos:
# General hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-docstring-first
- id: check-json
exclude: "tsconfig.*json"
- id: check-yaml
- id: check-toml
- id: check-executables-have-shebangs
- id: end-of-file-fixer
exclude_types:
- svg
- pofile
exclude: "(^LICENSE$)"
- id: mixed-line-ending
args:
- "--fix=lf"
- id: trailing-whitespace
exclude_types:
- svg
- id: check-case-conflict
- id: detect-private-key
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v3.0.3'
hooks:
- id: prettier
types_or:
- javascript
- ts
- markdown
exclude: "(^Pipfile\\.lock$)"
# Python hooks
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.292'
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

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.1.0] - 2023-10-15

### Added

- Chromium conversion routes
- LibreOffice conversion routes
- PDF/A conversion route
- PDF merge route
- Health status route
- Testing and typing all setup and passing
Loading

0 comments on commit a98e9db

Please sign in to comment.