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

Anki 2.1.54 qt5 #4

Open
wants to merge 263 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
263 commits
Select commit Hold shift + click to select a range
7699ebd
Simplify RustBackend import
glutanimate May 17, 2021
08a8641
Merge pull request #4 from glutanimate/more-robust-type-imports
glutanimate Jun 13, 2021
b8accc9
Merge pull request #5 from BlueGreenMagick/add-py-typed
glutanimate Jun 13, 2021
37a2434
Update CONTRIBUTORS
glutanimate Jun 13, 2021
6261d7a
Add basic support for installing und uninstalling decks
glutanimate Jun 14, 2021
698ec9f
Finish UI set-up in order to load toolbar
glutanimate Jun 14, 2021
005f369
Make sure to run main_window_did_init hook after loading profile
glutanimate Jun 14, 2021
05b4c30
Add comment on current hook teardown behavior
glutanimate Jun 14, 2021
e71c9cb
Merge pull request #7 from glutanimate/fix-toolbar-and-hooks
glutanimate Jun 14, 2021
01ddcb0
Add helper method for installing add-ons
glutanimate Jun 14, 2021
206d05e
Disable add-on update checks
glutanimate Aug 23, 2021
9808223
Make sure to finish UI set-up post add-on loading
glutanimate Aug 23, 2021
1b15fdf
Allow initializing Anki session with add-ons pre-installed
glutanimate Aug 23, 2021
6c301d7
Refactor library structure
glutanimate Aug 23, 2021
4adbcd1
Switch to explicit imports for better API readability
glutanimate Aug 23, 2021
333b7b2
Packaged → Packed
glutanimate Aug 23, 2021
a045138
Fix docstring
glutanimate Aug 23, 2021
ba28790
Handle nullable objects more graciously
glutanimate Aug 23, 2021
b3b2afc
Add _errors module
glutanimate Aug 23, 2021
ed16278
Add Anki as a dependency and bump min Python version to 3.8
glutanimate Aug 23, 2021
4435c77
Fix support for Anki 2.1.45+ by including FlagManager
glutanimate Aug 23, 2021
938681f
Fix mw init patching by switching to a factory function
glutanimate Aug 23, 2021
0cac43e
Fix deck helper import
glutanimate Aug 23, 2021
a88b7f2
Merge pull request #6 from glutanimate/deck-support
glutanimate Aug 24, 2021
61fbcf3
Merge branch 'master' into addon-support
glutanimate Aug 24, 2021
89830af
Merge pull request #8 from glutanimate/addon-support
glutanimate Aug 24, 2021
0f75e57
Merge pull request #2 from andrewsanchez/fix-workflow
glutanimate Aug 24, 2021
6366351
Bump version, preparing for breaking changes with v0.x.x API
glutanimate Aug 24, 2021
fd83984
Update .gitignore
glutanimate Aug 24, 2021
bcb6b91
Switch from setup.py to poetry
glutanimate Aug 24, 2021
ee47b37
Update test runner, removing need for dynamically registering plugin
glutanimate Aug 24, 2021
fee20a1
pyflakes → flake8
glutanimate Aug 24, 2021
5062f56
Remove installation step as Anki installation is now handled by poetry
glutanimate Aug 24, 2021
c4308a9
Make sure to install Poetry
glutanimate Aug 24, 2021
2a7b194
Limit workflow trigger to PRs for now
glutanimate Aug 24, 2021
fa28961
Configure poetry install action
glutanimate Aug 24, 2021
fb04fda
Try switching back to Ubuntu runner
glutanimate Aug 24, 2021
d81be2a
Attempt reducing threads
glutanimate Aug 24, 2021
5951992
Attempt to debug Qt platform plugin error
glutanimate Aug 24, 2021
5d4f8f3
Add missing xcb dependency
glutanimate Aug 24, 2021
341de1c
Fix package name
glutanimate Aug 24, 2021
bb81422
Add further missing X.org dependencies
glutanimate Aug 24, 2021
94bb7ad
Another attempt at adding missing deps
glutanimate Aug 24, 2021
f05a2ea
Check if libqt5 sufficient as dependency
glutanimate Aug 24, 2021
8ccd8c2
Test whether correct Qt version used in workflow
glutanimate Aug 24, 2021
32a980f
Qt version test passed, so remove debug statement
glutanimate Aug 24, 2021
62ed978
Add comment on Qt dependencies
glutanimate Aug 24, 2021
fa50507
Remove Qt debug env var and restore threaded pytest runs
glutanimate Aug 24, 2021
74dfa53
Merge pull request #9 from glutanimate/switch-to-poetry
glutanimate Aug 24, 2021
ab3751c
Update workflow status badge
glutanimate Aug 24, 2021
028f36f
Update credits
glutanimate Aug 24, 2021
bf52cbd
Fix badge URL
glutanimate Aug 24, 2021
e277f9f
Tweak formatting and wording
glutanimate Aug 24, 2021
e9fb660
Also trigger workflow on push to main
glutanimate Aug 24, 2021
f90f355
Fix indent
glutanimate Aug 24, 2021
3200904
Make badge specific to main triggers
glutanimate Aug 24, 2021
0b043da
Switch to Makefile to coordinate project tooling
glutanimate Aug 24, 2021
0462d9d
Configure test matrix for Anki 2.1.35, 2.1.44, and 2.1.46
glutanimate Aug 24, 2021
d2abb11
Add 2.1.28 to test matrix
glutanimate Aug 24, 2021
48185b5
Add 2.1.26, even though it's likely to fail
glutanimate Aug 24, 2021
7257ff9
Try to adjust mw __init__ patch to older APIs
glutanimate Aug 24, 2021
a17ccfe
Always yield deck_id as int
glutanimate Aug 24, 2021
5904f4e
Give 2.1.23 a spin
glutanimate Aug 24, 2021
d1fc026
Drop 2.1.23, not available on PyPI
glutanimate Aug 24, 2021
55302ed
Update test matrix to 2.1.47
glutanimate Aug 30, 2021
9d6de9a
Downgrade Python on 2.1.44+ to 3.8.1
glutanimate Aug 30, 2021
87e8a3b
Merge pull request #12 from glutanimate/test-matrix
glutanimate Aug 30, 2021
13e6809
Rewrite AnkiSession as custom class, moving profile API to it
glutanimate Aug 30, 2021
62ef27f
Add a collection property for quick access to Anki collection
glutanimate Aug 30, 2021
5570600
Move local config creation API to AnkiSession
glutanimate Aug 30, 2021
75150ab
Configure mypy and isort
glutanimate Aug 30, 2021
ac7e4e5
Move Anki config object handling to AnkiSession
glutanimate Aug 30, 2021
336ba9c
Move deck handling to AnkiSession
glutanimate Aug 30, 2021
ebb46a2
Remove obsolete "helpers" module
glutanimate Aug 30, 2021
c0d785f
Remove unnecessary anki_session import and expose anki_running
glutanimate Aug 30, 2021
b432f60
Tweak argument naming
glutanimate Aug 30, 2021
d7d4da6
Adjusts tests and launch procedure to new API. Fix fixture init.
glutanimate Aug 30, 2021
b793c2a
Fix types imports
glutanimate Aug 30, 2021
84394d5
Run isort
glutanimate Aug 30, 2021
60c775f
Drop pyvirtualdisplay workaround
glutanimate Aug 30, 2021
a0e7d32
Tweak variable names
glutanimate Aug 30, 2021
a4730e4
Add API for dynamically loading add-ons
glutanimate Aug 30, 2021
ff3a407
Add docstrings for all API properties and methods
glutanimate Aug 30, 2021
f14cc0a
Add TODO note
glutanimate Aug 30, 2021
dba962d
Make sure to cast deck IDs to int on older Anki versions
glutanimate Aug 30, 2021
bdb7151
Merge pull request #13 from glutanimate/refactor-anki-session-api
glutanimate Aug 30, 2021
bea1b2b
Use a tuple instead of a custom type to specify unpacked add-ons
glutanimate Aug 30, 2021
6997299
Improve typing for anki_session fixture
glutanimate Aug 30, 2021
243e5a4
Tweak fixture docstrings
glutanimate Aug 30, 2021
2fceb34
Add support for specifying preset add-on configurations via fixture
glutanimate Aug 30, 2021
ada4833
Run isort and black
glutanimate Aug 30, 2021
fc73d05
Switch to more specific variable name
glutanimate Aug 30, 2021
31f1807
Add ability to pre-configure Anki configuration objects
glutanimate Aug 30, 2021
ede8c17
Refactor presetting Anki configuration, fixing execution order
glutanimate Aug 30, 2021
54f5eef
Expose PresetAnkiState
glutanimate Aug 30, 2021
6e0e4e6
Add docstrings for PresetAnkiState and related methods
glutanimate Aug 30, 2021
bb186d8
Expose AnkiStorageObject
glutanimate Aug 30, 2021
1d88dcf
synced_storage → colconf_storage
glutanimate Aug 30, 2021
90f2903
Add PresetAnkiState API to AnkiSession, trimming its Anki object API
glutanimate Aug 30, 2021
7c8ce67
Tweak anki state object name
glutanimate Aug 31, 2021
cf7ccfe
Merge pull request #14 from glutanimate/addon-config-parametrization
glutanimate Aug 31, 2021
28fa1b9
Add Makefile targets for type-checking, linting, and formatting
glutanimate Aug 31, 2021
7f48c49
Fix remaining typing issues and run linters
glutanimate Aug 31, 2021
ad0607b
Add flake8 configuration
glutanimate Aug 31, 2021
38975f5
Add linting and type checks to pipeline. Use env to define latest Anki.
glutanimate Aug 31, 2021
fc9bb44
Switch back to hard-coding latest Anki config
glutanimate Aug 31, 2021
9dc1b7d
Fix QMainWindow import
glutanimate Aug 31, 2021
62d230e
Run poetry update
glutanimate Aug 31, 2021
2087c1c
Merge pull request #15 from glutanimate/add-type-checking-and-linting
glutanimate Aug 31, 2021
e4978f4
Add black check to lint target
glutanimate Aug 31, 2021
fbac75e
Remove keep_profile option
glutanimate Aug 31, 2021
4374d9e
Run black
glutanimate Aug 31, 2021
1ceaa42
Actually use custom profile name if specified
glutanimate Aug 31, 2021
db6f39d
Add tests for specifying base_path, base_name, and profile_name
glutanimate Aug 31, 2021
bba46ba
Drop force_early_profile_load option
glutanimate Aug 31, 2021
e33752e
Shift docstring position
glutanimate Aug 31, 2021
51419f2
Merge anki session properties tests into one. Add profile loaded test.
glutanimate Aug 31, 2021
0a76e50
Add test for installing add-ons
glutanimate Aug 31, 2021
dc722e6
Remove debug statement
glutanimate Aug 31, 2021
9f6abe5
Add test for pre-configuring add-on config
glutanimate Aug 31, 2021
f7411a7
Add test for pre-configuring Anki state
glutanimate Aug 31, 2021
c08ea2b
Fix preset Anki state test
glutanimate Aug 31, 2021
3383313
Simplify exception types
glutanimate Aug 31, 2021
a2b64a1
Expose AnkiSessionError
glutanimate Aug 31, 2021
d0f2c0b
Add test for AnkiSession collection loading API
glutanimate Aug 31, 2021
8d09b0c
Split tests up into two modules
glutanimate Aug 31, 2021
e505531
Fix swapped names
glutanimate Aug 31, 2021
922ada8
Expand profile loading tests
glutanimate Aug 31, 2021
e727ed4
Drop obsolete direct dependency on PyVirtualDisplay
glutanimate Aug 31, 2021
15f2dc0
Set the "forked" marker for the entire test suite
glutanimate Aug 31, 2021
2482d44
Run linters
glutanimate Aug 31, 2021
4f5d4d6
Fix collection test case for Anki 2.1.26
glutanimate Sep 1, 2021
210915d
Make copyright statements more consistent. Slight refactor in test.
glutanimate Sep 1, 2021
90d813b
Refactor fixture name passing
glutanimate Sep 1, 2021
146d137
Run formatters on tests
glutanimate Sep 1, 2021
2ca3a4d
Refactor plugin entry point
glutanimate Sep 1, 2021
11c92e4
Add docstrings to Makefile
glutanimate Sep 1, 2021
2cfcc9d
Update keywords and classifiers
glutanimate Sep 1, 2021
a19036b
Add test for deck management
glutanimate Sep 1, 2021
dd4c3c6
Make default_config parameter optional and introduce arg validation
glutanimate Sep 1, 2021
532aec9
Use assertions in helper functions rather than return
glutanimate Sep 1, 2021
af626c2
Set defaults for user_config and default_config
glutanimate Sep 1, 2021
ac7c863
Add test for add-on config management
glutanimate Sep 1, 2021
eb66431
Fix typo
glutanimate Sep 1, 2021
91807f0
Add docstring for update_anki_state
glutanimate Sep 1, 2021
7d26f93
Add test for state update API
glutanimate Sep 1, 2021
bd1f45b
Add test for dynamically loading add-on
glutanimate Sep 1, 2021
5bf4b0c
Make sure to provide cardsToo arg on legacy Anki versions
glutanimate Sep 1, 2021
f5c9fd6
Include tests directory in code health tools
glutanimate Sep 1, 2021
b13de9c
Merge pull request #18 from glutanimate/extend-test-coverage
glutanimate Sep 1, 2021
1485922
Tweak argument order and sync docstrings
glutanimate Sep 1, 2021
132d5ce
Add support for QTWEBENGINE_REMOTE_DEBUGGING
glutanimate Sep 1, 2021
c5d51f5
If web debugging requested, only yield session after interface up
glutanimate Sep 3, 2021
c1a1f14
Remove obsolete snippet
glutanimate Sep 3, 2021
20f3594
No longer expose anki_running
glutanimate Sep 3, 2021
e5e1665
Add API for running test function against Selenium Chrome driver
glutanimate Sep 3, 2021
6f5ef1e
Split off signals from QRunnable
glutanimate Sep 3, 2021
79f0769
Tweak method naming and selenium imports
glutanimate Sep 3, 2021
230c2ae
Allow specifying web view to run web driver function in
glutanimate Sep 3, 2021
168373a
Add enum to simplify specifying Anki web view type
glutanimate Sep 3, 2021
1eccfd0
Rename web view type enum
glutanimate Sep 3, 2021
46c8031
Run formatters
glutanimate Sep 3, 2021
a1658c1
Use a dynamically determined port for web debugging
glutanimate Sep 3, 2021
ac732bd
Enable web debugging by default
glutanimate Sep 3, 2021
6aa874a
Add check for web debugging availability
glutanimate Sep 3, 2021
e2e5985
Refactor passing of task args and kwargs
glutanimate Sep 3, 2021
a0834a1
Add tests for web view debugging API
glutanimate Sep 3, 2021
df65187
Run formatters
glutanimate Sep 3, 2021
1538e45
Remove unused import
glutanimate Sep 3, 2021
2cf457e
Add autoflake to formatters. Add PyQt5-stubs to improve Qt type checks.
glutanimate Sep 4, 2021
a2b8022
Refactor qInstallMessageHandler patch to pacify mypy
glutanimate Sep 4, 2021
94a09b0
Add chrome version to matrix and adjust versions to follow macOS
glutanimate Sep 4, 2021
1911013
Adjust lint-and-check job to new version matrix
glutanimate Sep 4, 2021
88bf726
Add chromedriver installation step
glutanimate Sep 4, 2021
845e5a5
Switch to custom chromedriver setup action
glutanimate Sep 4, 2021
724bead
Fix chromedriver action
glutanimate Sep 4, 2021
3085ad0
Give setup-chromedriver another try
glutanimate Sep 4, 2021
ec011bd
Try another custom chrome driver installation step
glutanimate Sep 4, 2021
ee7e416
Try waiting after clicking on "Default" to switch to deck view
glutanimate Sep 4, 2021
9ed8636
Instead of fixed delay, use qtbot.wait_until to wait for state switch
glutanimate Sep 4, 2021
2d6b4e8
Merge pull request #20 from glutanimate/add-qtwebengine-remote-debugg…
glutanimate Sep 4, 2021
76977dc
Configure dependabot for automated anki and aqt update PRs
glutanimate Sep 4, 2021
db0ba7c
Try using composite action in workflow
glutanimate Sep 4, 2021
44270f0
Rename action
glutanimate Sep 4, 2021
c87952d
Make sure to check out before running action
glutanimate Sep 4, 2021
d8cacd0
Introduce more action composition
glutanimate Sep 4, 2021
15a64a3
Fix checkout order
glutanimate Sep 4, 2021
a564555
Fix and refactor input names
glutanimate Sep 4, 2021
b9515c4
Move setup_env into correct folder
glutanimate Sep 4, 2021
7768044
Split Anki setup off from system setup
glutanimate Sep 4, 2021
a1797c5
Fix action name and remove unused inputs
glutanimate Sep 4, 2021
beff989
Prepare actions and arguments for use in Anki pre-release testing
glutanimate Sep 4, 2021
3b8ca28
Switch to specifying latest Anki defaults in setup_ actions
glutanimate Sep 4, 2021
304da15
Split pytest matrix up into legacy versions and current version
glutanimate Sep 4, 2021
d770504
Split checks off into action
glutanimate Sep 4, 2021
d7584c7
Try moving defaults back up a level
glutanimate Sep 4, 2021
fd2df1c
Simplify action set-up again, moving defaults back to workflow
glutanimate Sep 4, 2021
e06d33d
Read current Anki configuration from local JSON
glutanimate Sep 4, 2021
d4358c1
Check out before reading, use proper JSON format, set needs keys
glutanimate Sep 4, 2021
801b0ad
Debug matrix-dependant jobs not firing
glutanimate Sep 4, 2021
330d33d
Disable other jobs
glutanimate Sep 4, 2021
1cf239d
Another debugging attempt
glutanimate Sep 4, 2021
3e6bd5b
Fix indentation
glutanimate Sep 4, 2021
adf1692
Echo content directly
glutanimate Sep 4, 2021
385236e
Give inline example a try
glutanimate Sep 4, 2021
82c84d5
Another attempt at JSON processing
glutanimate Sep 4, 2021
e5dda8d
Remove print debug statement
glutanimate Sep 4, 2021
7be10d8
Consistently list Anki at top of matrix entries
glutanimate Sep 4, 2021
7c57b17
Re-enable jobs disabled for debugging
glutanimate Sep 4, 2021
e1a429c
Add comment
glutanimate Sep 4, 2021
2483b23
Rename workflow
glutanimate Sep 4, 2021
8522056
Add workflow for dependabot PRs
glutanimate Sep 4, 2021
64c6ff6
Merge pull request #21 from glutanimate/follow-anki-releases
glutanimate Sep 4, 2021
33f49ec
Update test status badge
glutanimate Sep 4, 2021
4ed2e09
Update README
glutanimate Sep 4, 2021
1a45f87
Fix pytest link
glutanimate Sep 4, 2021
3248342
Tweak README
glutanimate Sep 5, 2021
40f664e
Bump version: 1.0.0-dev.1 → 1.0.0-beta.1
glutanimate Sep 5, 2021
cdcc9f9
Update README, tweaking sections and adding contribution instructions
glutanimate Sep 5, 2021
caef643
Rename workflow
glutanimate Sep 5, 2021
4c6d732
Add badges
glutanimate Sep 5, 2021
14a72ba
Bump version: 1.0.0-beta.1 → 1.0.0-beta.2
glutanimate Sep 5, 2021
ca3b7b9
Update development status
glutanimate Sep 5, 2021
148d9d7
Ignore errors when removing directory tree
glutanimate Sep 5, 2021
0ff1b17
Improve credits wording
glutanimate Sep 5, 2021
88736a0
Add ignored paths to "push" workflow trigger
glutanimate Sep 5, 2021
ee2ba83
Remove "anki" from dependabot dependencies
glutanimate Sep 5, 2021
6cb6e48
Tweak ignored paths
glutanimate Sep 5, 2021
4d6342f
Remove print debug statement
glutanimate Sep 5, 2021
d195fca
Add set_timeout method. Rename run_in_thread.
glutanimate Sep 5, 2021
d9e4152
Tweak argument naming
glutanimate Sep 5, 2021
a97c114
Cache web driver instance
glutanimate Sep 5, 2021
942ecbf
Run formatters
glutanimate Sep 5, 2021
cf67e62
Fix typo
glutanimate Sep 9, 2021
16d3d86
Explicitly define public interface via __all__
glutanimate Oct 14, 2021
f56aaac
Constrain Anki version
glutanimate Oct 14, 2021
629ff5e
Merge pull request #22 from glutanimate/polishing
glutanimate Oct 14, 2021
3562b65
Bump version: 1.0.0-beta.2 → 1.0.0-beta.3
glutanimate Oct 14, 2021
975030f
Fix import.
andrewsanchez Feb 13, 2022
f031a45
PyQt6.
andrewsanchez Feb 13, 2022
c7cf335
deps bump.
andrewsanchez Feb 13, 2022
e6f765e
Actually fix import.
andrewsanchez Feb 13, 2022
4ed64a7
update requirements.
andrewsanchez Apr 22, 2022
dfbb44c
Import from aqt.
andrewsanchez Apr 22, 2022
564c77b
Catch backend io error and ignore.
andrewsanchez May 29, 2022
851c494
Bump anki deps.
andrewsanchez Jun 18, 2022
f7d58f2
Anki 2.1.54 and qt5.
andrewsanchez Jul 6, 2022
caf6db7
Remove qt6.
andrewsanchez Jul 6, 2022
31d05b9
Return highest level did from install_deck
RisingOrange Jul 10, 2022
48d4533
Merge remote-tracking branch 'risingorange/anki-2.1.54-qt5' into anki…
andrewsanchez Jul 11, 2022
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
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
ignore = E203, E266, E501, W503
max-line-length = 88
exclude = .git,__pycache__,tests/samples/
41 changes: 41 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Set up test environment"
description: "Set up test environment"

inputs:
python:
description: "Python interpreter version"
required: true
anki:
description: "Anki version. Set this to 'prerelease' to install either the latest release or prerelease."
required: true
pyqt:
description: "PyQt widget toolkit version"
required: true
pyqtwebengine:
description: "PyQt WebEngine version"
required: true
chrome:
description: "Chrome version"
required: true

runs:
using: "composite"
steps:
- name: Checkout pytest-anki
uses: actions/checkout@v2

- name: Set up environment
uses: ./.github/actions/setup_system
with:
python: ${{ inputs.python }}
chrome: ${{ inputs.chrome }}

- name: Set up project
uses: ./.github/actions/setup_project

- name: Set up Anki
uses: ./.github/actions/setup_anki
with:
anki: ${{ inputs.anki }}
pyqt: ${{ inputs.pyqt }}
pyqtwebengine: ${{ inputs.pyqtwebengine }}
28 changes: 28 additions & 0 deletions .github/actions/setup_anki/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Set up Anki"
description: "Set up Anki"

inputs:
anki:
description: "Anki version. Set this to 'prerelease' to install either the latest release or prerelease."
required: true
pyqt:
description: "PyQt widget toolkit version"
required: true
pyqtwebengine:
description: "PyQt WebEngine version"
required: true

runs:
using: "composite"
steps:
- name: Set up Anki ${{ inputs.anki }}
shell: bash
run: |
pip install --upgrade setuptools pip
pip install --upgrade PyQt5==${{ inputs.pyqt }} PyQtWebEngine==${{ inputs.pyqtwebengine }}

if [[ "${{ inputs.anki }}" == "prerelease" ]]; then
pip install --upgrade --pre anki aqt
else:
pip install --upgrade anki==${{ inputs.anki }} aqt==${{ inputs.anki }}
fi
16 changes: 16 additions & 0 deletions .github/actions/setup_project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Set up project"
description: "Set up project"

runs:
using: "composite"
steps:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.8
virtualenvs-create: false

- name: Set up pytest-anki
shell: bash
run: |
make install
37 changes: 37 additions & 0 deletions .github/actions/setup_system/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Set up system"
description: "Set up system"

inputs:
python:
description: "Python interpreter version"
required: true
chrome:
description: "Chrome version"
required: true

runs:
using: "composite"
steps:
# Qt5 requires a number of X11-related dependencies to be installed system-wide.
# Rather than installing each individually, we install libqt5 on the machine which
# in turn takes care of installing all deps also needed for the PyPI version of Qt5
- name: Install xvfb / qt dependencies
shell: bash
run: |
sudo apt-get install libqt5gui5

- name: Set up chromedriver
shell: bash
run: |
chrome_version=${{ inputs.chrome }}
truncated_version=${chrome_version%.*}
driver_version=$(curl --location --fail --retry 10 "http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${truncated_version}")
wget -c -nc --retry-connrefused --tries=0 "https://chromedriver.storage.googleapis.com/${driver_version}/chromedriver_linux64.zip"
unzip -o -q "chromedriver_linux64.zip"
sudo mv chromedriver /usr/local/bin/chromedriver
rm "chromedriver_linux64.zip"

- name: Set up Python ${{ inputs.python }}
uses: actions/[email protected]
with:
python-version: ${{ inputs.python }}
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-name: "aqt"

54 changes: 54 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Dependabot tests

on:
pull_request


jobs:
read-current-anki-matrix:
# Reads current Anki set-up from anki-current.json
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- name: Checkout pytest-anki
uses: actions/checkout@v2
- id: set-matrix
run: |
content=$(cat ./anki-current.json)
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
content="{ \"include\": [ ${content} ] }"
echo "::set-output name=matrix::$content"

test-newly-published-anki:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
needs: read-current-anki-matrix

strategy:
matrix: ${{ fromJSON(needs.read-current-anki-matrix.outputs.matrix) }}

steps:
- name: Checkout pytest-anki
uses: actions/checkout@v2

- name: Set up environment
uses: ./.github/actions/setup_system
with:
# We assume that these will remain constant across most Anki updates.
# However, sometimes this will break.
python: ${{ matrix.python }}
chrome: ${{ matrix.chrome }}

- name: Set up project
uses: ./.github/actions/setup_project

- name: Run tests for Anki
shell: bash
run: |
make test
137 changes: 137 additions & 0 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: tests

on:
pull_request:
paths-ignore:
- "**.md"
- "docs/**"
- ".github/dependabot.yml"
push:
branches:
- main
paths-ignore:
- "**.md"
- "docs/**"
- ".github/dependabot.yml"

jobs:
read-current-anki-matrix:
# Reads current Anki set-up from anki-current.json
runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- name: Checkout pytest-anki
uses: actions/checkout@v2
- id: set-matrix
run: |
content=$(cat ./anki-current.json)
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
content="{ \"include\": [ ${content} ] }"
echo "::set-output name=matrix::$content"

check-current-anki:
needs: read-current-anki-matrix
runs-on: ubuntu-18.04

strategy:
matrix: ${{ fromJSON(needs.read-current-anki-matrix.outputs.matrix) }}

steps:
- name: Checkout pytest-anki
uses: actions/checkout@v2

- name: Set up test environment
uses: ./.github/actions/setup
with:
python: ${{ matrix.python }}
chrome: ${{ matrix.chrome }}
anki: ${{ matrix.anki }}
pyqt: ${{ matrix.pyqt }}
pyqtwebengine: ${{ matrix.pyqtwebengine }}

- name: Run type checker for Anki ${{ matrix.anki }}
shell: bash
run: |
make check

- name: Run linter for Anki ${{ matrix.anki }}
shell: bash
run: |
make lint

test-current-anki:
needs: read-current-anki-matrix
runs-on: ubuntu-18.04

strategy:
matrix: ${{ fromJSON(needs.read-current-anki-matrix.outputs.matrix) }}

steps:
- name: Checkout pytest-anki
uses: actions/checkout@v2

- name: Set up test environment
uses: ./.github/actions/setup
with:
python: ${{ matrix.python }}
chrome: ${{ matrix.chrome }}
anki: ${{ matrix.anki }}
pyqt: ${{ matrix.pyqt }}
pyqtwebengine: ${{ matrix.pyqtwebengine }}

- name: Run tests for Anki ${{ matrix.anki }}
shell: bash
run: |
make test

test-old-anki:
runs-on: ubuntu-18.04
strategy:
matrix:
include:
# Version matrix follows static macOS builds as closely as possible.
# Some Qt package versions are not available on PyPI, so we need to make
# compromises here and there.
- anki: 2.1.44
python: 3.8.6
pyqt: 5.14.2
pyqtwebengine: 5.14.0
chrome: 77.0.3865.129
- anki: 2.1.35
python: 3.8.0
pyqt: 5.14.2
pyqtwebengine: 5.14.0
chrome: 77.0.3865.129
- anki: 2.1.28
python: 3.8.0
pyqt: 5.15.0
pyqtwebengine: 5.15.0
chrome: 80.0.3987.163
- anki: 2.1.26
python: 3.8.0
pyqt: 5.13.1
pyqtwebengine: 5.13.1
chrome: 73.0.3683.105

steps:
- name: Checkout pytest-anki
uses: actions/checkout@v2

- name: Set up test environment
uses: ./.github/actions/setup
with:
python: ${{ matrix.python }}
chrome: ${{ matrix.chrome }}
anki: ${{ matrix.anki }}
pyqt: ${{ matrix.pyqt }}
pyqtwebengine: ${{ matrix.pyqtwebengine }}

- name: Run tests for Anki ${{ matrix.anki }}
shell: bash
run: |
make test
Loading