Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update extension workflows and docs #22

Merged
merged 16 commits into from
Sep 27, 2024
23 changes: 23 additions & 0 deletions .github/workflows/check-master-manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: check master manifest

on:
push:
branches:
- feature/*
pull_request:
branches:
- main

jobs:
manifest:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Check master extensions manifest
run: |
pip install --user check-jsonschema
check-jsonschema --schemafile json-schema/master-manifest.json extensions.json
4 changes: 2 additions & 2 deletions .github/workflows/extension-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ on:
jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write

steps:

- name: Checkout
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: manifest

on:
workflow_call:

jobs:
manifest:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Check extension manifest
run: |
pip install --user check-jsonschema
curl -o /tmp/extension-manifest.json https://raw.githubusercontent.com/nzbgetcom/nzbget-extensions/main/json-schema/extension-manifest.json
check-jsonschema --schemafile /tmp/extension-manifest.json manifest.json
18 changes: 18 additions & 0 deletions .github/workflows/prospector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: prospector

on:
workflow_call:

jobs:
prospector:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Run prospector static analysis
run: |
pip install --user prospector
prospector --strictness medium -i lib
47 changes: 35 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,44 @@ This repository contains a list of NZBGet extensions, which is used by the Exten

## If you want to add your extension to this list, you will need

1. Make your extension compatible with NZBGet spec v23+.
1. Make your extension compatible with NZBGet spec v23+.
[Documentation](https://github.com/nzbgetcom/nzbget/blob/develop/docs/extensions/EXTENSIONS.md).

2. Once your extension is ready, please contact NZBGet maintainers to get it added into the extension manager
(we'll create a project for you - `https://github.com/nzbgetcom/Extension-YourExtensionName/`).
2. Make sure that your extension repository contains the required and possibly optional workflows:

3. Create a fork of that repository, add your extension to it, and make a Pull request.
<ul>

>You can use any of nzbgetcom extension as example,
e.g [FakeDetector](https://github.com/nzbgetcom/Extension-FakeDetector).
- Mandatory:
- [Prospector Python Static Analysis check](WORKFLOWS.md#prospector)
- [Manifest check](WORKFLOWS.md#manifest)

## Questions
You can use [issues](https://github.com/nzbgetcom/nzbget/issues) for any questions.
- Optional:
- [Tests check](WORKFLOWS.md#tests) (Having tests for your extension is highly recommended)
- [Release workflow](WORKFLOWS.md#release)
</ul>

## Maintainers:
- [luckedea](https://github.com/luckedea)
- [phnzb](https://github.com/phnzb)
- [dnzbk](https://github.com/dnzbk)
<ul>

Reusable workflows can be used from the current repository.

Workflows [documentation](WORKFLOWS.md).

For an example of their use, please refer to the Example extensions repository (see [below](#example-extension-can-be-used-as-quickstart)).

</ul>

3. Once your extension is ready, please contact NZBGet maintainers (by creating [Issue](https://github.com/nzbgetcom/nzbget/issues) or [Discussion](https://github.com/nzbgetcom/nzbget/discussions)) to get it added into the extension manager.
We will create a fork of your extension repository, mirror your release to include it in the extension manager, and make a PR to that repository.

## Example extension (can be used as quickstart):

https://github.com/nzbgetcom/Extenson-Example

Demonstrates:
- Using extension parameters
- Using Tests
- Using workflows:
- Prospector check
- Manifest check
- Tests check
- Release workflow
110 changes: 110 additions & 0 deletions WORKFLOWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Reusable workflows for NZBGet Extensions:

- [Prospector](#prospector)
- [Manifest](#manifest)
- [Tests](#tests)
- [Release](#release)

## Prospector

Runs [Prospector](https://prospector.landscape.io) static analysis check (strictness - medium, bundled libs ignored).

Recommended use: branch and tags push

Example:

```
jobs:
prospector:
uses: nzbgetcom/nzbget-extensions/.github/workflows/prospector.yml@main
```

## Manifest

Runs extension manifest check with check-jsonschema.

Recommended use: branch and tags push

Example:

```
jobs:
manifest:
uses: nzbgetcom/nzbget-extensions/.github/workflows/manifest.yml@main
```

## Tests

Can be used with extensions written in python. Runs tests check with specified python versions.

Recommended use: branch and tags push

Parameters:

- `python-versions`

Python versions for running tests, space separated

- `supported-python-versions`

Python versions for which tests must be passed without error

- `test-script`

Name of test script in repository

- `debug`

Enable debug output, recommended

Example:

```
jobs:
tests:
uses: nzbgetcom/nzbget-extensions/.github/workflows/python-tests.yml@main
with:
python-versions: "3.6 3.7 3.8 3.9 3.10 3.11 3.12"
supported-python-versions: "3.8 3.9 3.10 3.11 3.12"
test-script: tests.py
debug: true
```

## Release

Create extension release from tag.

Recommended use: `v*` tags push

Parameters:

- `release-file-list`

Space separated list of files to include in release archive. Wildcards can be used. To include directory with contents, end its name with '/'

- `release-file-name`

Base file name for release archive. For an example: `videosort` will create release archives like `videosort-10.9-dist.zip`

- `release-dir`

Top level directory in release archive to put all files in

Example:

```
name: release

on:
push:
tags:
- "v*"

jobs:
release:
uses: nzbgetcom/nzbget-extensions/.github/workflows/extension-release.yml@main
with:
release-file-list: lib/ ChangeLog.txt README.* main.py manifest.json
release-file-name: videosort
release-dir: VideoSort
```
Loading