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

Replace travis with github actions #142

Closed
merwok opened this issue Dec 3, 2021 · 17 comments
Closed

Replace travis with github actions #142

merwok opened this issue Dec 3, 2021 · 17 comments
Assignees
Labels
enhancement New feature or request

Comments

@merwok
Copy link
Contributor

merwok commented Dec 3, 2021

Most projects have left Travis because of the management issues.
It seems that tests for PRs here are not run any more.
I could convert the config to github actions (example conversions from circleci: caravancoop/configstore#47)

@merwok merwok added the enhancement New feature or request label Dec 3, 2021
@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Dec 3, 2021

@merwok it is already in my intentions to switch from travis to GitHub actions.

I saw that there is something to use tox in the GitHub action to avoid the matrix duplication.

If you can do it, I really appreciate it and then propagate it to all other django packages.

@merwok
Copy link
Contributor Author

merwok commented Dec 3, 2021

There’s tox-gh-actions which works in many cases but has some issues (so I didn’t use it in the project I linked):
ymyzk/tox-gh-actions#66
ymyzk/tox-gh-actions#44

I think a strategy could be to use the matrix config to list all testenvs that are wanted, and remove them from tox config. The envlist setting can list the testenv(s) to use when someone runs tox without parameters (for local dev), it is not required to contain all permutations. I’ll experiment in some days!

@fabiocaccamo
Copy link
Owner

@merwok in the end I used tox-gh-actions, there are more pro than cons, and it is easier to maintain it on multiple packages.

@fabiocaccamo
Copy link
Owner

@merwok after the migration from TravisCI to GitHub actions, coverage reports are no more uploaded to codecov, have you any idea of what the cause could be?

@merwok
Copy link
Contributor Author

merwok commented Jan 12, 2022

I’ve only used codecov indirectly in companies, don’t have it for my personal projects.
(I look at HTML report locally and text report in CI, with covered file omitted and missing lines reported, so I find it enough)

The workflow file does not use a codecov action, so it would make sense that data is not uploaded 🙂
But I think there have been a few security issues with codecov recently, so I don’t know if I would spend time to use it.

@fabiocaccamo
Copy link
Owner

@merwok FYI I published an action for defining a matrix like the following one directly in the GitHub workflow: https://github.com/marketplace/actions/create-matrix-action

python-version {3.7}, django-version {2.0,2.1,2.2,3.0,3.1,3.2}, database {sqlite,mysql,postgres}
python-version {3.8}, django-version {2.2,3.0,3.1,3.2}, database {sqlite,mysql,postgres}
python-version {3.9}, django-version {2.2,3.0,3.1,3.2}, database {sqlite,mysql,postgres}
python-version {3.10}, django-version {3.2,4.0}, database {sqlite,mysql,postgres}

Any feedback/contribution is appreciated.

@merwok
Copy link
Contributor Author

merwok commented Mar 8, 2022

I like the idea of using strings to define matrix lines!
I don’t see a matrix.json file in the action repo or this one, so that part is confusing.

(Minor feedback: cat is used to concatenate files, not stream one file — UUOC 😉)

@fabiocaccamo
Copy link
Owner

The matrix.json file is generated by the workflow script on the fly, only to be able to read the generated matrix using ${{fromJson(needs.create_matrix.outputs.matrix)}} in the next step. (check here).

Probably it is possible to avoid the json file creation and set the script output directly to and env variable.

How can I set the variable value with the file content without using cat? (I'm not skilled on this part)

@merwok
Copy link
Contributor Author

merwok commented Mar 8, 2022

Probably it is possible to avoid the json file creation and set the script output directly to and env variable.

GitHub Actions don’t have to save everything in env vars like other CI systems, they have the nice output system to pass data between jobs!

For cat, the wikipedia article I linked discusses alternatives.

@fabiocaccamo
Copy link
Owner

GitHub Actions don’t have to save everything in env vars like other CI systems, they have the nice output system to pass data between jobs!

I compute the matrix json in the action script.py file, do you know if it is possible to set the output variable directly from inside the script?

@merwok
Copy link
Contributor Author

merwok commented Mar 8, 2022

If the script prints its output to stdout with the right ::thing prefix, the data should be captured as an output!

@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Mar 10, 2022

@merwok done: https://github.com/marketplace/actions/create-matrix-action

Thank you for the feedback and the tips.

@merwok
Copy link
Contributor Author

merwok commented Mar 10, 2022

Ah that’s great! Thank you for making that action!

@merwok
Copy link
Contributor Author

merwok commented Mar 10, 2022

I quite like it! https://github.com/caravancoop/configstore/runs/5495913834

Wonder if something can be done to make the docker image pre-built (22s to build now)

@fabiocaccamo
Copy link
Owner

Maybe caching the output matrix using the matrix input as key?

@fabiocaccamo
Copy link
Owner

@merwok have you found a way to cache the docker image / output matrix?

@merwok
Copy link
Contributor Author

merwok commented Apr 13, 2022

Haven’t had the opportunity to look at it.
Could check out https://github.com/marketplace/actions/docker-layer-caching

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

No branches or pull requests

2 participants