Skip to content

Commit

Permalink
Update from add-on template
Browse files Browse the repository at this point in the history
  • Loading branch information
abdnh committed Dec 6, 2023
1 parent ae490a1 commit a0ab587
Show file tree
Hide file tree
Showing 44 changed files with 871 additions and 332 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = src/forms/*,src/vendor/*
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github: abdnh
patreon: abdnh
custom: ["https://www.buymeacoffee.com/abdnh"]
custom: ["https://www.buymeacoffee.com/abdnh"]
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Run checks & tests

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

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies
run: .github/workflows/install_deps.sh

- name: Build
run: make

- name: Run checks
run: SKIP=pip-compile pre-commit run --all-files

- name: Run tests
run: make test
42 changes: 42 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create Release

on:
create:
tags:
- "*"
permissions:
contents: write
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies
run: .github/workflows/install_deps.sh

- name: Create packages
run: make vendor && make

- name: Extract changes
shell: bash
run: |
python -m ankiscripts.changes ${{ github.ref }} > build/RELEASE.md
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/*.ankiaddon
body_path: build/RELEASE.md
5 changes: 5 additions & 0 deletions .github/workflows/install_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

pip install -r requirements/base.txt
pip-sync requirements/dev.txt
sudo apt install libxcb-xinerama0 libxcb-cursor0 libegl1
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
__pycache__/
*.egg-info/
venv/
.mypy_cache/
.pytest_cache/
htmlcov/
.coverage
ankidata/
build/
src/manifest.json
src/meta.json
src/forms/
src/user_files/*/
src/vendor/
vendor/
node_modules/
TODO.md
samples/
samples/
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[settings]
profile=black
skip=forms,vendor,venv,ankidata,user_files
skip=venv,ankidata,vendor,forms,user_files,build
83 changes: 83 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
exclude: "venv|vendor|build"
default_stages: [commit]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
exclude: ".vscode(.dist)?/.*"
- id: check-yaml
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: check-shebang-scripts-are-executable
- id: mixed-line-ending
- id: detect-private-key

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: local
hooks:
- id: pylint
name: pylint
entry: python -m pylint src tests
language: system
types: [python]
require_serial: true
- id: mypy
name: mypy
entry: python -m mypy
language: system
types: [python]
require_serial: true
- id: pyupgrade
name: pyupgrade
entry: pyupgrade --py38-plus
language: system
types: [python]
require_serial: true
- id: pip-compile
name: pip-compile base
entry: python -m ankiscripts.update_deps --type base
language: system
files: ^(requirements/base\.(in|txt))$
pass_filenames: false
require_serial: true
- id: pip-compile
name: pip-compile bundle
entry: python -m ankiscripts.update_deps --type bundle
language: system
files: ^(requirements/bundle\.(in|txt))$
pass_filenames: false
require_serial: true
- id: pip-compile
name: pip-compile dev
entry: python -m ankiscripts.update_deps --type dev
language: system
files: ^(requirements/dev\.(in|txt))$
pass_filenames: false
require_serial: true

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.1
hooks:
- id: prettier
args: ["--tab-width", "4", "--write"]
exclude: "ankiweb_page.html"
exclude_types: [python]

ci:
autoupdate_schedule: weekly
skip: []
submodules: false
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[MASTER]
extension-pkg-whitelist=PyQt6,PyQt5
ignore = venv|ankidata|vendor|forms|user_files
ignore = venv,ankidata,vendor,forms,user_files,build

[REPORTS]
output-format=colorized
Expand Down
3 changes: 3 additions & 0 deletions .pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
testpaths =
tests
10 changes: 10 additions & 0 deletions .vscode.dist/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"ms-python.python",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-python.isort",
"matangover.mypy",
"abdo.ankiwebify"
]
}
13 changes: 13 additions & 0 deletions .vscode.dist/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run add-on",
"type": "python",
"request": "launch",
"module": "ankiscripts.run",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
14 changes: 8 additions & 6 deletions .vscode.dist/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"editor.formatOnSave": true,
"[html]": {
"editor.formatOnSave": false
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"python.formatting.provider": "black",
"[html]": {
"editor.formatOnSave": false
}
}
"editor.formatOnSave": true
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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.0.0/),
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).

## [1.1.1] - 2023-05-22
Expand Down
Loading

0 comments on commit a0ab587

Please sign in to comment.