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

Add new operation: CI-Check #33

Open
11 tasks
mautamu opened this issue Sep 14, 2021 · 3 comments
Open
11 tasks

Add new operation: CI-Check #33

mautamu opened this issue Sep 14, 2021 · 3 comments

Comments

@mautamu
Copy link
Member

mautamu commented Sep 14, 2021

Howdy,

To prevent issues like leftwm/leftwm#436 and leftwm/leftwm-community-themes#25, we should add a CI operation for leftwm-community-themes that performs the following checks:

  • Known.toml is valid TOML
  • Runs the change operations (See Replace space in theme name with - or _ #9) to make sure none of them need applied to known.toml itself (e.g. a Change to name Sunflower to sunflower, but the known.toml has a theme named Sunflower)
  • Checks that all names are unique
  • Checks that all Change UUIDs are unique
  • Checks that all theme names match the currently acceptable requirements
  • Checks that the theme repository exists (download it)
  • Checks that the theme repository contains up, down, and theme.toml at a minimum (use relative_directory, and download as per above)
  • Warns (with flag --new-versions or similar) of outdated commits
  • Sets (with flag --set-versions or similar) the version of each theme equal to the current commit HEAD tag
  • Sets (with flag --set-commit or similar) the commit of each theme equal to the current commit HEAD sum
    Bonus:
  • Find a way to determine the minimum leftwm version and set that

Example:

[leftwm-community-themes@leftwm ~]$ leftwm-theme ci-check
[OK] known.toml valid
[OK] all changes are applied
[OK] all changes have unique ID
[OK] all themes have unique name
[OK] all themes have an acceptable name
[1/2] Checking theme `sunflower`
    => Repository downloaded successfully
    => Contains up with proper permissions
    => Contains down with proper permissions
    => Contains valid theme.toml with proper permissions
[2/2] Checking theme `soothe` in `soothe/theme/`
    => Repository downloaded successfully
    => Sub-directory entered successfully
    => Contains up with proper permissions
    => Contains down with proper permissions
    => Contains valid theme.toml with proper permissions

Example 2 (with flags):

[leftwm-community-themes@leftwm ~]$ leftwm-theme ci-check --set-versions --set-commit
[OK] known.toml valid
[OK] all changes are applied
[OK] all changes have unique ID
[OK] all themes have unique name
[OK] all themes have an acceptable name
[1/2] Checking theme `sunflower`
    => Repository downloaded successfully
    => Contains up with proper permissions
    => Contains down with proper permissions
    => Contains valid theme.toml with proper permissions
    => Version upgraded from 0.0.1 to 0.1.0
    => Commit set to 9c504d9
[2/2] Checking theme `soothe` in `soothe/theme/`
    => Repository downloaded successfully
    => Sub-directory entered successfully
    => Contains up with proper permissions
    => Contains down with proper permissions
    => Contains valid theme.toml with proper permissions
    => Version remains 0.1.0
    => Commit set to 643ad4e

Example 3 (errors):

[leftwm-community-themes@leftwm ~]$ leftwm-theme ci-check
[Err] known.toml valid:
  Error: Unknown character ~, line 1, column 1. TOML could not be parsed.

Example 4 (errors):

[leftwm-community-themes@leftwm ~]$ leftwm-theme ci-check --set-versions --set-commit
[OK] known.toml valid
[Err] all changes are applied
  Error: theme "Soothe" not renamed to "soothe"
  Help: change name="Soothe" to name="soothe"
[Err] all changes have unique ID
  Error: change (uuid1) is not unique
  Help: insert new UUID for uuid1
[Err] all themes have unique name
  Error: theme "sunflower" is defined twice.
  Help: rename all but one instance of "sunflower", or delete duplicate entries.
[Err] all themes have an acceptable name
  Error: theme "Soothe" does not have an acceptable name.
@mautamu
Copy link
Member Author

mautamu commented Sep 14, 2021

(feel free to follow a different style for errors, this is just a suggestion. it would be helpful to maybe follow the style of leftwm-check).

@VuiMuich
Copy link
Member

VuiMuich commented Sep 16, 2021

I'd like to suggest some additional checks:

  • theme.toml is parsable
  • up and down scripts have proper permissions
  • up script symlinks or copies down script to /tmp/leftwm-down-theme, as this will be the place other themes will look for a down script
  • up and down scripts have a shebang and leftwm command "LoadTheme in up or leftwm command "UnloadTheme" in down (not sure if export SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" and the use of it in LoadTheme should be enforced as well?)

@mautamu
Copy link
Member Author

mautamu commented Oct 22, 2021

Blocked on leftwm/leftwm#496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants