HiveMinds / tw-install

Automatically installs Taskwarrior, Taskserver (TODO: and Timewarrior). This project aims to support automated installation of all Taskwarrior hook scripts, configuration flavours etc. with a single command.
GNU Affero General Public License v3.0
17 stars 7 forks source link

Set up continuous integration testing #63

Closed a-t-0 closed 2 years ago

a-t-0 commented 3 years ago
mohitsaxenaknoldus commented 3 years ago

Please assign it to me, I'll do it.

create-issue-branch[bot] commented 3 years ago

Branch issue-63-Set_up_continuous_integration_testing created!

a-t-0 commented 3 years ago

Awesome, my Travis credits are through. I intend to host my own GitLab CI not upcoming week but the week after that. However, just give me a headsup if you want to verify the CI, I will use another account.

Here is an example that has CI enabled: https://github.com/a-t-0/shell_unit_testing_template

mohitsaxenaknoldus commented 3 years ago

I think 9 tasks are a lot for this one issue. Can we split this?

a-t-0 commented 3 years ago

Yes, I removed the "host your own GitLab - related tasks", (those is almost done over here:https://github.com/TruCol/setup_your_own_GitLab_CI over here anyway) and I got another account for Travis CI credits.

So basically if you focus on the remaining 5 issues on actually setting up the CI configuration in this repo (which is what the title is about), then it would be wonderful!

Thank you for indicating the impractical workload, and for suggesting a solution!

mohitsaxenaknoldus commented 3 years ago

Sure! I've set up the project on Gitlab. I'll write a CI pipeline now.

mohitsaxenaknoldus commented 3 years ago

You want me to use GitLab right? @a-t-0 or TravicCI?

a-t-0 commented 3 years ago

In the end I will host my own GitLab using that other repo but that repo also still requires some work, and I did not yet figure out how to mirror this GitHub repository in the GitLab server. So if you can figure that out/can automate mirroring the this GitHub while you run it on your own/some GitLab, it would be a nice bonus.

However, if you do not want to bother with GitLab, you can simply push the working CI configuration for travis. In that case, I will fork it and run Travis CI from another account. So it is up to you, what you find fun :)

mohitsaxenaknoldus commented 3 years ago

In the end I will host my own GitLab using that other repo but that repo also still requires some work, and I did not yet figure out how to mirror this GitHub repository in the GitLab server. So if you can figure that out/can automate mirroring the this GitHub while you run it on your own/some GitLab, it would be a nice bonus.

I've done this much. I'll push the pipeline file tomorrow so you can merge it with the master. I've tested it and it's working for all commits and PR's. Then, I'll help you mirror the repo with the GitLab server. Is it somehow possible for you to give me guest access to your GitLab server so I can do the setup? If not, I can give instructions here as well on how to mirror.

a-t-0 commented 3 years ago

Awesome! Thanks, my GitLab server is not running yet, as I am still improving the installation procedure. So I cannot give you guest access right now. When I run tests I remove the Server and install a new one, so a manual configuration of a mirror would currently go lost. A brief script that mirrors this GitHub on an arbitrary GitLab server would be appreciated, otherwise I'll look into that later (I'm slightly time constraint so can't set that up upcomming 3 days).

Nice work, I look forward to the pipeline creation:)

mohitsaxenaknoldus commented 3 years ago

Awesome! Thanks, my GitLab server is not running yet, as I am still improving the installation procedure. So I cannot give you guest access right now. When I run tests I remove the Server and install a new one, so a manual configuration of a mirror would currently go lost. A brief script that mirrors this GitHub on an arbitrary GitLab server would be appreciated, otherwise I'll look into that later (I'm slightly time constraint so can't set that up upcomming 3 days).

Nice work, I look forward to the pipeline creation:)

Thanks!

Btw what's the need to remove and install a new server everytime? You can just integrate with GitLab with a free account and let it run the tests.

I have one more question, what does the test directory do? I saw it links to 3 different repos. Can you explain what those repos do and how your tests are running?

a-t-0 commented 3 years ago

Thanks for your questions,

Assumptions

  1. I think with "integrate with GitLab with a free account and let it run the tests" you mean let some other computer run the tests.
  2. I believe there is no free lunch, so if one is able to run computations on another device,, I believe, most likely, you are the product (that is being sold).
  3. So I prefer to run my own CI on my own GitLab server.
  4. I want to enable other people to also host their own services as easily as possible (for the same reasons).
  5. I think "as easily as possible" is just a single click/command/copy paste (in these times).

Background

I automated setting up your own self-hosted GitLab server, but the procedure is not yet working perfectly, if I run the tests, the first time it starts setting up the server correctly but the tests fail, then I need to wait until the GitLab server is started until I can run the tests again, this time successfully. So I need to improve the code such that the test passes the first time it is ran.

Answers

  1. The remove and install, is because I did not yet write that GitLab self-host deployment code that it tests on another GitLab server than the one the software installs. So to test if it is installed correctly, the test first installs my own GitLab server. Once that test works well, and the installer works well, I will ensure that the GitLab installation procedure is able to be tested without uninstalling the actual GitLab server. Ideally, I would be able to run the deployment script to start my own GitLab CI runner, and then in that GitLab CI, run the deployment script again to see if the deployment script passes its own tests. That is where I will draw the line.

  2. The test directory contains the unit-test files (Bash Automated Testing System, in short BATS) files. For example this one: https://github.com/TruCol/setup_your_own_GitLab_CI/blob/master/test/test_src_helper.bats the CI should run the test.sh file in the root directory, e.g. this one and that script will run all the (relevant) .bats in the /test/ folder.

It is nice of you to ask, because I thought I already included .bats test files in this repository, but I noticed there aren't any in the /test/ directory, so I can still work on that.

Did that answer your questions?

mohitsaxenaknoldus commented 3 years ago

Yes, thanks for the explanation. Great thoughts!

mohitsaxenaknoldus commented 2 years ago

@a-t-0 Can you add the .bats test files here so I can run those as tests?

a-t-0 commented 2 years ago

I can not allocate time for that right now, if you want you can copy any arbitrary test/bats file, e.g. from https://github.com/TruCol/setup_your_own_GitLab_CI/blob/master/test/test_src_helper.bats or from productivityphone, and for example modify it to write an test with an assert that checks whether the


remove_logs() {
  rm -r src/logs/*
}

of file https://github.com/HiveMinds-EU/tw-install/blob/main/src/helper.sh actually removed the folder. Otherwise I will do it next week.

mohitsaxenaknoldus commented 2 years ago

Ok i'll do that👍

mohitsaxenaknoldus commented 2 years ago

@a-t-0 When are these src/logs/* logs created? I don't have a logs folder inside the src.

mohitsaxenaknoldus commented 2 years ago

Also, PR: https://github.com/HiveMinds-EU/tw-install/pull/88