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

lots of extension updates #59

Merged
merged 9 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ci/release
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import shutil

is_ci = os.environ.get('CI') is not None

def main():
def main() -> None:
import argparse
p = argparse.ArgumentParser()
p.add_argument('--test', action='store_true', help='use test pypi')
args = p.parse_args()

extra = []
if args.test:
extra.extend(['--repository-url', 'https://test.pypi.org/legacy/'])
extra.extend(['--repository', 'testpypi'])

root = Path(__file__).absolute().parent.parent
os.chdir(root) # just in case
Expand All @@ -42,7 +42,7 @@ def main():
if dist.exists():
shutil.rmtree(dist)

check_call('python3 setup.py sdist bdist_wheel', shell=True)
check_call(['python3', '-m', 'build'])

TP = 'TWINE_PASSWORD'
password = os.environ.get(TP)
Expand Down
2 changes: 1 addition & 1 deletion .ci/run
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ if ! command -v python3 &> /dev/null; then
fi

"$PY_BIN" -m pip install --user tox
"$PY_BIN" -m tox
"$PY_BIN" -m tox --parallel --parallel-live "$@"
47 changes: 28 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ on:
pull_request: # needed to trigger on others' PRs
# Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them".
workflow_dispatch: # needed to trigger workflows manually
# todo cron?
# todo cron?
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false


jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest] # , windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
# 3.11 on windows has this bug, lxml setup fails
#https://bugs.launchpad.net/lxml/+bug/1977998
exclude: [{platform: windows-latest, python-version: '3.11'}]
platform: [ubuntu-latest, macos-latest] #, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
# vvv just an example of excluding stuff from matrix
# exclude: [{platform: macos-latest, python-version: '3.6'}]

Expand All @@ -31,56 +35,61 @@ jobs:
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # nicer to have all git history when debugging/for tests

# uncomment for SSH debugging
# - uses: mxschmitt/action-tmate@v3
- uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}

# explicit bash command is necessary for Windows CI runner, otherwise it thinks it's cmd...
- run: bash .ci/run

- if: matrix.platform == 'ubuntu-latest' # no need to compute coverage for other platforms
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: .coverage.mypy_${{ matrix.platform }}_${{ matrix.python-version }}
path: .coverage.mypy/


###
build_extension:
env:
name: 'grasp'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v3
fetch-depth: 0 # nicer to have all git history when debugging/for tests

- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- run: extension/.ci/build --lint # debug version
- run: extension/.ci/build --lint --release

# TODO ugh. can't share github actions artifacts publicly...
# TODO for fuck's sake... why does it end up named as .zip.zip ????
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: '${{ env.name }}-chrome-debug-latest.zip'
path: 'extension/dist/artifacts/chrome/${{ env.name }}_dev_-*.zip'
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
.name : '${{ env.name }}-chrome-release-latest.zip'
name : '${{ env.name }}-chrome-release-latest.zip'
path: 'extension/dist/artifacts/chrome/${{ env.name }}-*.zip'
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name : '${{ env.name }}-firefox-debug-latest.zip'
path: 'extension/dist/artifacts/firefox/${{ env.name }}_dev_-*.zip'
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name : '${{ env.name }}-firefox-release-latest.zip'
path: 'extension/dist/artifacts/firefox/${{ env.name }}-*.zip'
1 change: 0 additions & 1 deletion extension/.ci/build
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ npm install

FAILED=0

npm run flow || FAILED=1
npm run eslint || FAILED=1
# TODO later
#npm run test || FAILED=1
Expand Down
38 changes: 0 additions & 38 deletions extension/.eslintrc.js

This file was deleted.

14 changes: 0 additions & 14 deletions extension/.flowconfig

This file was deleted.

5 changes: 5 additions & 0 deletions extension/build
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def main():
p.add_argument('--watch' , action='store_true')
p.add_argument('--lint' , action='store_true')
p.add_argument('--publish', action='store_true', help="Publish on chrome web store/addons.mozilla.org")
p.add_argument('--v3', action='store_const', const='3', dest='manifest')
p.add_argument('--v2', action='store_const', const='2', dest='manifest')

tg = p.add_mutually_exclusive_group(required=True)
tg.add_argument('--target', type=str, choices=TARGETS)
Expand All @@ -33,6 +35,8 @@ def main():

assert target is not None

manifest = args.manifest or '3'

base_ext_dir = Path(__file__).absolute().parent / 'dist'
ext_dir = (base_ext_dir / target).resolve() # webext can't into symlinks
# sadly no way to specify zip name in the regex..
Expand All @@ -50,6 +54,7 @@ def main():
'TARGET' : target,
'RELEASE': 'YES' if args.release else 'NO',
'PUBLISH': 'YES' if args.publish else 'NO',
'MANIFEST': manifest,
'EXT_ID' : IDS[target],
**os.environ,
}
Expand Down
24 changes: 24 additions & 0 deletions extension/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// @ts-check

const eslint = require('@eslint/js')
const tseslint = require('typescript-eslint')


module.exports = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended, // TODO recommendedTypeChecked??
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
},
],
},
},
)
101 changes: 0 additions & 101 deletions extension/flow-typed/webextension-polyfill.js

This file was deleted.

Loading