Skip to content

Commit

Permalink
Merge branch 'addonTemplate' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
aaclause committed Aug 15, 2023
2 parents 88f7091 + 80b9f9c commit a52180f
Show file tree
Hide file tree
Showing 5 changed files with 309 additions and 79 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build_addon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: build addon

on:
push:
tags: ["*"]
# To build on main/master branch, uncomment the following line:
# branches: [ main , master ]

pull_request:
branches: [ main, master ]

workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
sudo apt-get update -y
sudo apt-get install -y gettext
- name: Code checks
run: export SKIP=no-commit-to-branch; pre-commit run --all

- name: building addon
run: scons

- uses: actions/upload-artifact@v3
with:
name: packaged_addon
path: ./*.nvda-addon

upload_release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: ["build"]
steps:
- uses: actions/checkout@v3
- name: download releases files
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R

- name: Release
uses: softprops/action-gh-release@v1
with:
files: packaged_addon/*.nvda-addon
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref, '-') }}
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-yaml
69 changes: 47 additions & 22 deletions buildVars.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# coding: utf-8
import os.path
# -*- coding: UTF-8 -*-
import subprocess
import time

# Build customizations
# Change this file instead of sconstruct or manifest files, whenever possible.


# Since some strings in `addon_info` are translatable,
# we need to include them in the .po files.
# Gettext recognizes only strings given as parameters to the `_` function.
# To avoid initializing translations in this module we simply roll our own "fake" `_` function
# which returns whatever is given to it as an argument.
def _(arg):
return arg

updateChannel = "unknown"
hashCommit = "unknown"
outBranchName = subprocess.check_output(
Expand All @@ -17,23 +28,14 @@
if outBranchName.strip():
updateChannel = "stable" if outBranchName in [
"stable", "master"] else "dev"
# Build customizations
# Change this file instead of sconstruct or manifest files, whenever possible.

# Full getext (please don't change)


def _(x): return x


# Add-on information variables
addon_info = {
# for previously unpublished addons, please follow the community guidelines at:
# https://bitbucket.org/nvdaaddonteam/todo/raw/master/guidelines.txt
# add-on Name, internal for nvda
# add-on Name/identifier, internal for NVDA
"addon_name": "BrailleExtender",
# Add-on summary, usually the user visible name of the addon.
# Translators: Summary for this add-on to be shown on installation and add-on information.
# Translators: Summary for this add-on
# to be shown on installation and add-on information found in Add-ons Manager.
"addon_summary": _("Braille Extender"),
# Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
Expand Down Expand Up @@ -67,31 +69,54 @@ def _(x): return x
"\n* ", _("add actions and quick navigation through a rotor"), "."
],
# version
"addon_version": time.strftime("%y.%m.%d:") + hashCommit,
"addon_version": time.strftime("%y.%m.%d-") + hashCommit,
# Author(s)
"addon_author": "André-Abush Clause <[email protected]> " + _("and other contributors"),
# URL for the add-on documentation support
"addon_url": "https://andreabc.net/projects/NVDA_addons/BrailleExtender",
"addon_url": "https://github.com/aaclause/brailleExtender/",
# URL for the add-on repository where the source code can be found
"addon_sourceURL": "https://github.com/aaclause/brailleExtender/",
# Documentation file name
"addon_docFileName": "readme.html",
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
"addon_minimumNVDAVersion": "2021.1",
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion": "2023.1",
# Add-on update channel (default is stable or None)
# Add-on update channel (default is None, denoting stable releases,
# and for development releases, use "dev".)
# Do not change unless you know what you are doing!
"addon_updateChannel": updateChannel,
# Add-on license such as GPL 2
"addon_license": "GPL v2",
# URL for the license document the ad-on is licensed under
"addon_licenseURL": "https://www.gnu.org/licenses/gpl-2.0.html",
}


# Define the python files that are the sources of your add-on.
# You can use glob expressions here, they will be expanded.
pythonSources = [os.path.join("addon", "*.py"),
os.path.join("addon", "globalPlugins", "brailleExtender", "*.py")]

# You can either list every file (using ""/") as a path separator,
# or use glob expressions.
# For example to include all files with a ".py" extension from the "globalPlugins" dir of your add-on
# the list can be written as follows:
# pythonSources = ["addon/globalPlugins/*.py"]
# For more information on SCons Glob expressions please take a look at:
# https://scons.org/doc/production/HTML/scons-user/apd.html
pythonSources = []

# Files that contain strings for translation. Usually your python sources
i18nSources = pythonSources + ["buildVars.py"]

# Files that will be ignored when building the nvda-addon file
# Paths are relative to the addon directory, not to the root directory of your addon sources.
excludedFiles = []

# Base language for the NVDA add-on
# If your add-on is written in a language other than english, modify this variable.
# For example, set baseLanguage to "es" if your add-on is primarily written in spanish.
baseLanguage = "en"

# Markdown extensions for add-on documentation
# Most add-ons do not require additional Markdown extensions.
# If you need to add support for markup such as tables, fill out the below list.
# Extensions string must be of the form "markdown.extensions.extensionName"
# e.g. "markdown.extensions.tables" to add tables.
markdownExtensions = []
Loading

0 comments on commit a52180f

Please sign in to comment.