numixproject / numix-core

Builder for App Icon Themes
GNU General Public License v3.0
769 stars 146 forks source link

Travis-Ci #3583

Closed leoheck closed 7 years ago

leoheck commented 7 years ago

We can improve this repo with Travis-ci. We can build a script to validate data.json, check if the icon was added to the data.json and check if the both icons (circle and square) were added. So, when a PR is made, the user can see the tests and the missing stuff automatically. What do you think? It is also possible to automate other kinds of tasks.

leoheck commented 7 years ago

For example, considering numix-gtk-theme, the Travis-Ci can test compiling the sources. For the other repos, it can make the symlinks and deploy a version every time it detects a new commit/PR.

Foggalong commented 7 years ago

I quite like this idea, but I have literally no knowledge of using Travis-ci. If anyone else fancies giving it a bash then by all means get stuck in :)

bilelmoussaoui commented 7 years ago

I have been using Travis those last few months, i will give it a try on my fork and we will see

leoheck commented 7 years ago

I also started using it some weeks. It is a way to automate things. I just thought we can start with:

  1. a script to test the syntax o data.json. I just found this http://xmodulo.com/validate-json-command-line-linux.html right now and we can use it.
  2. a script to test if all icons are in circle and square folder and if all of them are in data.json.

This is just the start. @bil-elmoussaoui do you want to make it yourself? I start this task as well.

bilelmoussaoui commented 7 years ago

@leoheck Fir the second part, it's currently not needed. As it will always report that some icons are missing from square as the Square theme isn't complete yet. Adding the json validation was on my todo list

leoheck commented 7 years ago

Ok, so the second part can be changed like: check if all icons (circle/square) are in data.json.

bilelmoussaoui commented 7 years ago

I've done some work on this https://github.com/bil-elmoussaoui/numix-core/tree/travis, something is not working correctly with my schema file. If you want to take a look that would be much appreciated :)

leoheck commented 7 years ago

Do you have the Travis link to see it's outputs? I don't think you can change directory in one line an then execute something in another line.

leoheck commented 7 years ago

I found it https://travis-ci.org/bil-elmoussaoui/numix-core I will take a look

leoheck commented 7 years ago

I think you put "required" everywhere. I just saw "linux" sections on data.json. Required only in the first linux group just works. The schema.json should be carefully created. Also, we can add a script to the root, to validate the tests on the machine. So If I want to test it locally I can just run the ./validate.sh script for example. This will help the people which are working on a fork. Because the Travis will only work on the PRs.

leoheck commented 7 years ago

We have to improve the validator with debug information to easily the fixing task. I just used this to have an idea where the error was.

I also don't think we have to test with all python versions. You can put only a single python version on the .travis file.

leoheck commented 7 years ago

And it will be nice to add this Build Status status image to the repo README :)

bilelmoussaoui commented 7 years ago

@leoheck Fixed all of that :) i've also added pylint checks to verify the quality of the gen.py file @Foggalong what do you guys use to clean svg files ? i would like to get that used by travis to verify if the icons are cleaned

leoheck commented 7 years ago

Good, so, you have to improve the gen.py because now the build status is unknown.

To clean svg, I found this:

Inkscape have also a menu for that File >> Clean up document but I could not find a way to do that in command line.

bilelmoussaoui commented 7 years ago

It's not unkown but it fails ;) take a look at my branch, the badge always point to the master branch.. anyway, i will clean the script once this #3579 is merged ;)

leoheck commented 7 years ago

Yeah, you are right! Do you know what happens next when a numix-version is increased? Do the files are integrated into other repositories? This also can be automated.

bilelmoussaoui commented 7 years ago

@leoheck We don't want to automatically ship any new icon as this might include some broken stuff 👍 @Foggalong Travis have added cron jobs, we can do that to automatically create a release each month for example ?

Foggalong commented 7 years ago

@bil-elmoussaoui Thing I've not worked out re release automation is how to make the changelog :(

bilelmoussaoui commented 7 years ago

Well, it shouldn't be hard as we are using data.json, we can easily compare the data.json file in the latest release file and the current master and get the different between them, and create a changelog

leoheck commented 7 years ago

@bil-elmoussaoui I had an idea to use our Travis tests locally in the pc. In this way, it is also easy to run tests before the commit. Give a look at my fork.

It will need:

sudo -H pip install shyaml

And the dependencies you put on install section on .travis.yml

To test it, just clone my repo and execute ./tests.sh

leoheck commented 7 years ago

@bil-elmoussaoui why didn't you do the pull-request yet?

bilelmoussaoui commented 7 years ago

@leoheck I was little busy with other projects, i will add more functionalities by this week and open a RP :)

leoheck commented 7 years ago

Oh, ok then! Let me know if you want some help or if you have any idea to discuss. :) I am eager to see this working! hehe

bilelmoussaoui commented 7 years ago

@leoheck don't worry about that, i will everything done :) but if you have any idea, or modification please open a PR in my fork

leoheck commented 7 years ago

[idea] @bil-elmoussaoui, it is possible to create a test to verify if the document was cleaned checking if the docname is the same as the filename.

» grep docname icons/square/48/layouttextedit.svg
   sodipodi:docname="layouttextedit.svg"
bilelmoussaoui commented 7 years ago

@palob Do we have a proper config for svgcleaner-cli so i can use it to check whether the svg files are cleaned or not ? :)

palob commented 7 years ago

Unfortunately as things stand now using svgleaner causes that the baseplate gradient can't be edited anymore. This is due to long-standing bugs in Inkscape, rsvg and QtSVG. In the latest svgcleaner versions there isn't a way to work around this bug any more. See discussions https://github.com/numixproject/numix-tools/issues/7 and https://github.com/RazrFalcon/svgcleaner/issues/62.

In any case we should use our script which invokes svgcleaner without potentially harmful options.

Scour on the other hand doesn't allow to overwrite files and is much less powerful / much more error-prone.

bilelmoussaoui commented 7 years ago

@Foggalong Can you set up a travis account whenever you have some free time ? I've just cleaned up the script. Using pylint gen.py shouldn't complain about any error. Once the travis account is done, i'm going to do some tests for SVG validations also for the database file.

Foggalong commented 7 years ago

@bil-elmoussaoui So currently looking at Travising:

Is that right?

bilelmoussaoui commented 7 years ago

Yep, and in the future we can set up automatic releases every month for example

bilelmoussaoui commented 7 years ago

@Foggalong Any news? I would like to set up this before we start working on improving/updating the old square icons. My idea is to have a tests folder. Inside that folder we will have a couple of small scripts python/bash. The tests will be:

The most important part is the SVG tests for now, as the output on Travis will allow us to get a list of the icons that still need some work and work on it.

In the future: Travis now supports automatization which will allow us to run the gen script each week for example and create a new release automatically with the correct version number and an auto generated changelog (the issue/PR URL with its title)

mrmeszaros commented 7 years ago

@bil-elmoussaoui Considering the last release of the circle icon pack was in April, and the change log was referring to a commit message, I highly appreciate this endeavor.

However, for the Automatic change log generation we should create a PR naming convention, so that the change log remains readable.

Regarding the change-log-from-data.json: It only reflects the addition of new icons / symlinks / renaming. So any icon updates and fixes would go unnoticed.

I thought of creating a ChangeLog.md file template, and requesting the PR-s to extend it before merging them (just like it is needed to extend the data.json file). On release it could be archived (appending the date of the release), and cleared for the new sprint.

Of course, full automatization is the final goal, but it could be a good enough substitute for the time being.

bilelmoussaoui commented 7 years ago

@matemeszaros We will think about the best way to handle this either by adding a commit message convention or a ChangeLog file. For now, we should add the basic stuff first and improve it with time

Foggalong commented 7 years ago

@bil-elmoussaoui I got a Travis set up, but I've never actually used it before so I'm not really sure what I'm meant to be doing with it to get it working here. It's also set up to my own personal account because it was asking for a GitHub account (not an organisation) which doesn't seem quite right either :confused:

My only query was the testing of svgcleaner against the proposed file; is there a difference between saving as an optimised SVG through Inkscape and cleaning a normal SVG with SVG cleaner?

@matemeszaros Reason the change log referred directly to the commit was because of the vast number of icons changed, added, and removed (95 in that release). Similarly since with the effort to bring Square up to date 100s of new icons have been added not to mention all the older ones which have been optimised. I'm not sure having a normal changelog of every single change that's happened really makes sense in that context

bilelmoussaoui commented 7 years ago

@Foggalong I will set up the .travis.yaml file and create a PR for that. Once it's done, we will have to configure few things a bit. I don't know if there's any difference, we will have to decide whether we will use Inkscape or SVG cleaner with the the script in Numix labs

Foggalong commented 7 years ago

@bil-elmoussaoui Inkscape cleaning is how we've been recommending people do the optimisation and it doesn't require any extra software so it's probably the easiest one to go with.

mymindstorm commented 7 years ago

@Foggalong If you go to your travis profile and hit the "Review and add" button in the bottom of the sidebar on the left you can give it access to the organisation repos

Foggalong commented 7 years ago

@mymindstorm Done! Travis now has access to the Numix-Core repo :)

screenshot_2017-08-01_15-50-36

@bil-elmoussaoui Would you be able to guide me through setting up checks for Python and JSON? Those are probably the two easies to get going off the bat

bilelmoussaoui commented 7 years ago

The numix-core repository should have a .travis.yml file that shows to the virtual machine what should be done. You can check the hardcode-tray repository for a straight example on how to do so for PEP8. I would suggest putting related files to tests under a tests directory (we can create pre-commit hooks so the contributors can make use of them for easier PR reviews)

Foggalong commented 7 years ago

What do you mean by files related to tests?

bilelmoussaoui commented 7 years ago

@Foggalong to sperate each test case in a different file and we just need to execute them one after the other. Just to make it easier to improve and fix specific tests issues

Foggalong commented 7 years ago

I'm not gonna lie, I still don't understand what it is you're trying to tell me. What test cases?

mymindstorm commented 7 years ago

Like a script that returns true if the SVG is formatted correctly that travis runs if i'm understanding this correctly.

Foggalong commented 7 years ago

Ahhh okay that makes sense, thanks @mymindstorm!

bilelmoussaoui commented 7 years ago

In master, we have currently the Python linting & JSON linting and validation. In the future, I will add more tests like: