Skip to content

Commit

Permalink
Add Test (#4)
Browse files Browse the repository at this point in the history
* Add Test

* Add Badge

* Update Output

* Add setup.cfg

* Update Output

* Update README.md
  • Loading branch information
smashedr authored Jul 26, 2024
1 parent e1ba5a0 commit d227f39
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 24 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Test"

on:
workflow_dispatch:
push:
paths:
- "src/**"

jobs:
test:
name: "Test"
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Create JSON"
uses: jsdaniell/[email protected]
with:
name: "update.json"
json: '{"addons":{"test-id":{"updates":[]}}}'

- name: "Test Local Action"
id: test
uses: ./
with:
url: https://example.com/{version}
version: 1.0.0
addon_id: test-id

- name: "Validate Outputs"
env:
JSON: '{"addons": {"test-id": {"updates": [{"version": "1.0.0", "update_link": "https://example.com/1.0.0"}]}}}'
run: |
echo '${{ steps.test.outputs.url }}'
if [ '${{ steps.test.outputs.url }}' != 'https://example.com/1.0.0' ];then
echo "Invalid Output URL"
exit 1
fi
echo '${{ steps.test.outputs.result }}'
if [ '${{ steps.test.outputs.result }}' != '${{ env.JSON }}' ];then
echo "Invalid Output Result"
exit 1
fi
lint:
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Setup Python"
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: "Flake8"
run: |
python -m pip install flake8
flake8 src
41 changes: 18 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[![Tags](https://img.shields.io/github/actions/workflow/status/cssnr/mozilla-addon-update-action/tags.yaml?logo=github&logoColor=white&label=tags)](https://github.com/cssnr/mozilla-addon-update-action/actions/workflows/tags.yaml)
[![Test](https://img.shields.io/github/actions/workflow/status/cssnr/mozilla-addon-update-action/test.yaml?logo=github&logoColor=white&label=test)](https://github.com/cssnr/mozilla-addon-update-action/actions/workflows/test.yaml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cssnr_mozilla-addon-update-action&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cssnr_mozilla-addon-update-action)
[![GitHub Release Version](https://img.shields.io/github/v/release/cssnr/mozilla-addon-update-action?logo=github)](https://github.com/cssnr/mozilla-addon-update-action/releases/latest)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/parse-issue-form-action?logo=github&logoColor=white&label=updated)](https://github.com/cssnr/parse-issue-form-action/graphs/commit-activity)
[![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/mozilla-addon-update-action?logo=htmx&logoColor=white)](https://github.com/cssnr/mozilla-addon-update-action)
[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=github&logoColor=white)](https://cssnr.github.io/)
[![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY)
Expand Down Expand Up @@ -47,6 +49,19 @@ the `manfiest` key: `browser_specific_settings.gecko.id`
| url | Update URL Result |
| result | Update JSON Result |
```yaml
- name: "Mozilla Addon Update"
id: update
uses: cssnr/mozilla-addon-update-action@v1
with:
url: "https://github.com/cssnr/link-extractor/releases/download/{version}/link_extractor-firefox.xpi"

- name: "Echo Outputs"
run: |
echo '${{ steps.update.outputs.url }}'
echo '${{ steps.update.outputs.result }}'
```
## Notes
This action expects the `input_update` JSON file to exist, be valid JSON and have a matching addon_id entry.
Expand Down Expand Up @@ -81,26 +96,6 @@ Basic Example with All Inputs:
addon_id: [email protected]
```

Use Outputs:

```yaml
- name: "Mozilla Addon Update"
id: update
uses: cssnr/mozilla-addon-update-action@v1
with:
url: "https://github.com/cssnr/link-extractor/releases/download/{version}/link_extractor-firefox.xpi"
update: update.json
manifest: manifest.json
version: "1.0.0"
addon_id: [email protected]
- name: "Echo Outputs"
run: |
echo '${{ steps.update.outputs.url }}'
echo '${{ steps.update.outputs.result }}'
```

Simple Example:

```yaml
Expand Down Expand Up @@ -198,12 +193,12 @@ https://github.com/cssnr/aviation-tools/blob/master/.github/workflows/build.yaml

For general help or to request a feature see:

- Q&A Discussion: https://github.com/cssnr/virustotal-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/virustotal-action/discussions/categories/feature-requests
- Q&A Discussion: https://github.com/cssnr/mozilla-addon-update-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/mozilla-addon-update-action/discussions/categories/feature-requests

If you are experiencing an issue/bug or getting unexpected results you can:

- Report an Issue: https://github.com/cssnr/virustotal-action/issues
- Report an Issue: https://github.com/cssnr/mozilla-addon-update-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General
Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/?app=Mozilla%20Addon%20Update)
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 119
exclude = venv
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
print(f'url={url}', file=f)
print(f'result={json.dumps(result)}', file=f)

print('Finished Success.')
print('\u001b[32;1mFinished Success.')

0 comments on commit d227f39

Please sign in to comment.