Open oakkitten opened 2 years ago
Oh, and if setting up a job to build .ankiaddon
, it would be neat to use tags that start with v
, for instance, v1.2.3
, then you can say startsWith(github.ref, 'refs/tags/v')
. This is not ideal, but better than detecting if it starts with a number. Of course you can say startsWith(github.ref, 'refs/tags/')
but this is a tad too wide
This is more like a task to myself but I need some opinion.
Currently tests are broken for Anki <= 2.1.49 because of protobuf update. It got a major version bump and does not accept files created with some earlier versions of itself. Packages
anki
andaqt
which we are getting from pypi do not pin their dependencies. A simple solution would be to pin protobuf, but a proper solution would be to pin all dependencies ofanki
/aqt
.I found two ways to do this:
Use requirements.txt. Such as this for 2.1.49 and this one for 2.1.51. We can get them directly from GitHub using curl. These are problematic as:
HEAD
at the time of new version discoveryThis can be done approximately like this:
...plus changes to record pre-release hashes
Use... a time machine ⏳🚘? There's a pypi package that allows starting a proxy server that strips off packages that appear after a certain date.
This can be done like this:
A bit of crazy scripting to defeat the way pypi-timemachine outputs its URL, but we don't have to record hashes of pre-release versions. And while the code is crazier I think it's much less hacky than that above.
Both methods work. I am not sure which one is better. Edit: actually I think the time machine method is better. requirements.txt seems to be rather rarely updated.
A wise one will ask, what is this stuff about prerelease versions? Well, I think the best we can do with CI is to have an early warning when Anki breaks the addon. For this reason we should update CI with new versions of Anki. This may include prerelease versions.
I set up a dependabot-like system that makes PRs with new Anki versions to be included into tox.ini and tests.yml. Like this for “stable” versions and like this for pre-release onse. I don't know if the latter is a good idea. Perhaps it would be easier to just run daily CI tests with it. But if Anki doesn't get updated for a while, we might want to test new changes against the latest pre-release, if any. I'm not sure. Setting this up will require making (an empty) GitHub app by the owner of the project! It's not hard but it's a bit of work.
Also I set up a tiny build system that compiles the
.ankiaddon
file and makes a release. It also edits the config.md to put the exact version of the addon in there. This way we can troubleshoot. It's only run for version tags:Oh yeah, and the matrix.
Also I threw in a way to fast-forward merging of PRs via adding a label since GitHub doesn't support that.
I can make a PR with any subset of these but I want some opinion: