-
Notifications
You must be signed in to change notification settings - Fork 121
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
CI cleanup #450
CI cleanup #450
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests were cancelled... not sure why.
I guess that this is due to this error - which is due to fail-fast.
https://github.com/twisted/klein/pull/450/checks?check_run_id=1867537890#step:6:7
My suggestion is to use shorter names so that you don't have to check the HTML source code in order to see the full error message.
In this case, "Cancelled after 5 min" is not fully visible
.github/workflows/cicd.yml
Outdated
| @@ -183,7 +183,7 @@ jobs: | |||
| strategy: | |||
| matrix: | |||
| python: ["3.6", "3.7", "3.8", "3.9", "pypy3"] | |||
| twisted: ["19.2", "current"] | |||
| twisted: ["19.2", "current", "trunk"] | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe disable early failing that is causing cancellation and skipping of remaining jobs from the matrix.
| twisted: ["19.2", "current", "trunk"] | |
| twisted: ["19.2", "current", "trunk"] | |
| fail-fast: false |
Yup sorry @adiroiban this isn't ready yet, I'll mark it as draft. |
Codecov Report
@@ Coverage Diff @@
## master #450 +/- ##
=======================================
Coverage 98.71% 98.71%
=======================================
Files 45 45
Lines 3881 3881
Branches 249 249
=======================================
Hits 3831 3831
Misses 33 33
Partials 17 17 Continue to review full report at Codecov.
|
.github/workflows/cicd.yml
Outdated
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| matrix: | ||
| os: ["ubuntu-latest"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To simplify adding OSes to the matrix later.
| with: | ||
| fetch-depth: 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed by the Codecov action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That should be ok.
For PR builds, you can use the extra depth to get the last commit message... as HEAD is a merge with the PR target branch.
For paid runs I use this to skip a build on macos for example... when I am working on fixing a windows only bug.
- name: Fail on "skip macos"
if: ${{ github.event.after }}
run: git log -1 --pretty=format:"%s" ${{ toJSON(github.event.after) }} | grep -v 'skip macos'
Not an issue with klein as GitHub Action is free )
| - name: Translate Python version to Tox environment | ||
| id: tox_env | ||
| shell: python | ||
| run: | | ||
| set -eux | ||
| py="${{ matrix.python }}"; | ||
| if [ "${py#pypy}" != "${py}" ]; then # PyPy | ||
| py_test="${py}"; | ||
| else # CPython | ||
| py_test="py${py/./}"; # Add "py" prefix, remove "." | ||
| fi; | ||
| twisted="${{ matrix.twisted }}"; | ||
| twisted="tw${twisted/./}"; # Add "tw" prefix, remove "." | ||
| env_test="coverage-${py_test}-${twisted}"; | ||
| echo "Test environment: ${env_test}"; | ||
| ln -s ".tox/${env_test}" testenv; # Fixed location for upload step below | ||
| tox -e "${env_test}"; | ||
| py = "${{ matrix.python }}".replace(".", "").replace("pypy", "py") | ||
| tw = "${{ matrix.twisted }}".replace(".", "") | ||
| print(f"::set-output name=value::coverage-py{py}-tw{tw}") | ||
|
|
||
| - name: Run unit tests | ||
| run: tox -e ${{ steps.tox_env.outputs.value }}; | ||
|
|
||
| - name: Upload Trial log artifact | ||
| if: failure() | ||
| uses: actions/upload-artifact@v1 | ||
| with: | ||
| name: trial | ||
| path: testenv/log/trial.log | ||
| path: .tox/${{ steps.tox_env.outputs.value }}/log/trial.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This borrows a nice technique from Treq to map the Top environment in a step, then reuse the value later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Hat tip to @twm)
| .. image:: https://github.com/twisted/klein/workflows/CI%2fCD/badge.svg | ||
| :target: https://github.com/twisted/klein/actions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops no more Travis, yo
| @@ -22,7 +22,7 @@ deps = | |||
| tw1910: Twisted==19.10.0 | |||
| tw203: Twisted==20.3.0 | |||
| twcurrent: Twisted | |||
| twtrunk: git+https://github.com/twisted/twisted@trunk#egg=Twisted | |||
| twtrunk: https://github.com/twisted/twisted/tarball/trunk#egg=Twisted | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Word is this is faster
| deps = pipdeptree | ||
|
|
||
| commands = | ||
| pip freeze --exclude={env:PY_MODULE} | ||
| python -c 'print()' | ||
| pip freeze --exclude="{env:PY_MODULE}" | ||
|
|
||
| python -c 'print()' | ||
| pipdeptree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prints out the pip freeze output, which I use to compare against what is in setup.py occasionally, and it now adds a dependency tree which is handy for seeing why certain things are showing up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy to see pipdeptree here :)
| timeout-minutes: 30 | ||
| continue-on-error: ${{ matrix.optional }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adiroiban I found the continue-on-error docs have an example showing how to have a job not stop the workflow if it fails, so used that for trunk, which leaves fail-fast as something that we can turn on or off independently.
|
New feature: builds against Twisted trunk can now fail without failing the workflow, so you see "some checks were not successful" above, but the non-trunk jobs completed successfully, and the trunk job is not required, so it won't block merging. But we do see an obvious Thing Of Interest that probably needs fixing. |
|
I have as a final item to rename the unit test jobs so that they are more readable in the UI. I'll do that post-review, because it will require an associated config changes to keep the builds passing. |
|
Unfortunately, this doesn't show up as "success" in the PR list, though it ideally should… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks good.
For the record.
There is this https://github.com/twisted/python-info-action which tries to share things like "Workflow information" ... maybe we can have "Workflow information" inside that action and use the action in klein and other Twisted projects.
As part of this PR, a maybe also enable Read The Docs pull builds.
Let me know if you need help wit that ... or ask Thomas over IRC for help.
Thanks!
| with: | ||
| fetch-depth: 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. That should be ok.
For PR builds, you can use the extra depth to get the last commit message... as HEAD is a merge with the PR target branch.
For paid runs I use this to skip a build on macos for example... when I am working on fixing a windows only bug.
- name: Fail on "skip macos"
if: ${{ github.event.after }}
run: git log -1 --pretty=format:"%s" ${{ toJSON(github.event.after) }} | grep -v 'skip macos'
Not an issue with klein as GitHub Action is free )
| # specified above to the equivalents used in Tox environments. | ||
| - name: Translate Python version to Tox environment | ||
| id: tox_env | ||
| shell: python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice move :)
| deps = pipdeptree | ||
|
|
||
| commands = | ||
| pip freeze --exclude={env:PY_MODULE} | ||
| python -c 'print()' | ||
| pip freeze --exclude="{env:PY_MODULE}" | ||
|
|
||
| python -c 'print()' | ||
| pipdeptree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy to see pipdeptree here :)
| @@ -178,17 +178,27 @@ jobs: | |||
|
|
|||
| needs: [lint, mypy, docs, packaging] | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a question of taste.
I think that is good to reduce wasted test runs... but quite often I want to see the full errors of a commit, so that I can fix them all at once and then push a new general fix.
But for example, I have workflows in which if the Ubuntu tests fail, Win and macOS tests are not executed (to save money and save the environment)
I would prefer to run the ubuntu tests, even if mypy is not 100% happy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Travis, I had it set up so 1-2 unit test runs would go anyway, but that wasn't easily translated to GHA.
I may figure that out again later, but at the moment, this seems good enough.
I don't know if it's an issue with GHA, but I always found it annoying that I couldn't get a Travis result for a push because a million Twisted builds were queued up and many of them were wasting cycles on already-failed builds, and I think waste is waste so if you can't even mass listing steps, no need to try the unit test runs; it's not meaningfully slowing me down here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: all of those steps run pretty quickly locally.
|
@adiroiban Thanks for the review |

No description provided.