leftwm / leftwm-theme

A tool to help manage themes for LeftWM
BSD 3-Clause "New" or "Revised" License
117 stars 12 forks source link

Add new operation: CI-Check #33

Open mautamu opened 2 years ago

mautamu commented 2 years ago

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:

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 commented 2 years ago

(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 commented 2 years ago

I'd like to suggest some additional checks:

mautamu commented 2 years ago

Blocked on leftwm/leftwm#496