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

Travis CI tests not running #375

Closed
JimBacon opened this issue Jun 28, 2021 · 14 comments
Closed

Travis CI tests not running #375

JimBacon opened this issue Jun 28, 2021 · 14 comments

Comments

@JimBacon
Copy link
Member

If you follow the 'build passing' link on https://github.com/Indicia-Team/warehouse to https://travis-ci.org/Indicia-Team/warehouse there is a message saying

Since June 15th, 2021, the building on travis-ci.org is ceased. Please use travis-ci.com from now on.

It indicates that our tests have not run for 3 months. Hopefully it will be a simple matter to switch from one to the other. I'll try it out.

@JimBacon JimBacon self-assigned this Jun 28, 2021
@JimBacon
Copy link
Member Author

JimBacon commented Jul 1, 2021

It was, indeed, simple to migrate from travis-ci.org to travis-ci.com. But that was only the start of things. It was using an out of date linux image with out of date versions of postgresql and php. Tests are now running again with PHP7.3. PHP8 is a problem I am still investigating.

Travis now charge for their service but we are getting by on an initial free credit of 10000 units. As an open source project, we can request a monthly allowance of free credits. If this is not forthcoming, Github now have their own system we can use to replace Travis.

@JimBacon
Copy link
Member Author

JimBacon commented Jul 4, 2021

This has turned in to a lot more work than I was expecting. Our unit testing had been tied to PHPUnit v5. This is no longer supported and is listed as compatible with PHP only up to v7.1. I updated to the latest version of PHPUnit (v9 currently) but this necessitated updates to all our test classes. Moreover, our tests had a dependency on DbUnit which has been abandoned. I have switched to a fork of this which is being maintained but is only compatible with PHP up to v7.4 currently. That is to say, more work is required for supporting tests with PHP8.

When updating all the test classes, to allow the unit tests to run locally, I have created a Docker environment to mimic that used by Travis CI. This can be invoked by cd docker && ./phpunit.sh. It starts up a warehouse container, runs the local copy of tests against the local copy of the code, then shuts down and removes itself.

@JimBacon
Copy link
Member Author

JimBacon commented Jul 5, 2021

I put in a request to Travis for a free open-source subscription. They responded very quickly with the following:

To qualify for an Open Source subscription, the project must meet the following requirements:
• You are a project lead or regular committer (latest commit in the last month)
• Project must be at least 3 months old and is in active development (with regular commits and activity)
• Project meets the OSD specification
• Project must not be an expressly commercial project
• Project can not provide commercial services or distribute paid versions of the software
Does this sound like you and your project? We'd be very happy to support you!

We use the GNU General Public Licence which is approved by the Open Source Initiative as meeting the specification so I will confirm we meet all the requirements.

@JimBacon
Copy link
Member Author

JimBacon commented Jul 6, 2021

Travis have accepted our application for open source credits and kindly made us a donation.
They say

When your credits begin running low again, please reach back out to the Support team [email protected]

To monitor our consumption, see https://travis-ci.com/organizations/Indicia-Team/plan
I think we have enough to test about 700 pushes to Github which will be halved if and when I can get our tests to run for PHP8 as well.

@johnvanbreda
Copy link
Contributor

Is it possible to limit Travis so it only runs on certain pushes? It might be overkill to use credits unless changes are significant, or the build is approaching a release?

@JimBacon
Copy link
Member Author

JimBacon commented Jul 6, 2021

Good idea. Easy to limit by branch - https://docs.travis-ci.com/user/customizing-the-build#building-specific-branches

How about we limit it to pushes to dev and master? I think everyone is in good habits of working in branches and we don't want to inhibit frequent commits/pushes.

@johnvanbreda
Copy link
Contributor

I'm probably not always using branches as I should be, but if this is an incentive to always work on a feature branch then that's a good thing...

@JimBacon
Copy link
Member Author

JimBacon commented Jul 6, 2021

Now limited to commits to master and develop branches and to pull requests. The latter took me by surprise but may be helpful. There is a setting in https://app.travis-ci.com/github/Indicia-Team/warehouse/settings for it.

@johnvanbreda
Copy link
Contributor

I don't have permissions to view the settings. Does this mean that if I do a release, I have to do a pull request to merge develop into master in order to trigger the build? Normally I just do a merge, using --no-commit at first so I can review all the changes.

@BirenRathod
Copy link
Contributor

BirenRathod commented Jul 6, 2021

@johnvanbreda you don't need a separate permission for that. it is basically same as this link -> https://travis-ci.com/github/Indicia-Team/warehouse/settings. you just need to login using your github authentication

@JimBacon
Copy link
Member Author

JimBacon commented Jul 6, 2021

I was expecting Travis to behave as Biren says. My assumption was that if you authenticate with Github, then being an admin in Github would make you an admin in Travis. If that was fantasy on my part and it doesn't work for you, @johnvanbreda, then I'll have to dig a little deeper.

A build will be triggered whenever you push a commit to develop or master (if I've done it right - haven't actually tried it on master). I'm not expecting you to have to change your release process at all.

In addition, a push to a branch which is the subject off a pull request also triggers a build. I left this option on because I thought it would be helpful
a. For a person submitting a merge request to know if their code passes or whether they have more work to do.
b. For a person merging a request to know that the code passes before hitting the merge button.

Obviously if we never get a merge request it is neither here nor there!

@johnvanbreda
Copy link
Contributor

It's OK - I was allowed in, I hadn't spotted my session had logged out in Travis.

@johnvanbreda
Copy link
Contributor

Now that I've fixed a problem in the test suite I note that the develop branch is now building, and I'd expect the master to do the same once your work is merged across. https://app.travis-ci.com/github/Indicia-Team/warehouse/branches

@DavidRoy
Copy link

for info...
https://ropensci.org/blog/2020/11/19/moving-away-travis/

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

No branches or pull requests

4 participants