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

CI cleanup #450

Merged
merged 18 commits into from
Feb 18, 2021
Merged

CI cleanup #450

merged 18 commits into from
Feb 18, 2021

Conversation

wsanchez
Copy link
Member

No description provided.

@wsanchez wsanchez self-assigned this Feb 10, 2021
@wsanchez wsanchez requested a review from a team as a code owner February 10, 2021 00:16
Copy link
Member

@adiroiban adiroiban left a 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

image

@@ -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"]
Copy link
Member

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.

Suggested change
twisted: ["19.2", "current", "trunk"]
twisted: ["19.2", "current", "trunk"]
fail-fast: false

@wsanchez
Copy link
Member Author

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

image

Yup sorry @adiroiban this isn't ready yet, I'll mark it as draft.

@wsanchez wsanchez marked this pull request as draft February 10, 2021 03:17
@codecov
Copy link

codecov bot commented Feb 16, 2021

Codecov Report

Merging #450 (3e22097) into master (ce42479) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce42479...3e22097. Read the comment docs.

Comment on lines 181 to 185
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: ["ubuntu-latest"]
Copy link
Member Author

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.

Comment on lines +193 to +194
with:
fetch-depth: 2
Copy link
Member Author

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.

Copy link
Member

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 )

Comment on lines +204 to +220
- 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
Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Hat tip to @twm)

Comment on lines +5 to +6
.. image:: https://github.com/twisted/klein/workflows/CI%2fCD/badge.svg
:target: https://github.com/twisted/klein/actions
Copy link
Member Author

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
Copy link
Member Author

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

Comment on lines +374 to +381
deps = pipdeptree

commands =
pip freeze --exclude={env:PY_MODULE}
python -c 'print()'
pip freeze --exclude="{env:PY_MODULE}"

python -c 'print()'
pipdeptree
Copy link
Member Author

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.

Copy link
Member

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 :)

@wsanchez wsanchez marked this pull request as ready for review February 16, 2021 21:53
@wsanchez wsanchez marked this pull request as draft February 17, 2021 00:26
timeout-minutes: 30
continue-on-error: ${{ matrix.optional }}
Copy link
Member Author

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.

@wsanchez
Copy link
Member Author

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.

@wsanchez
Copy link
Member Author

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.

@wsanchez
Copy link
Member Author

Unfortunately, this doesn't show up as "success" in the PR list, though it ideally should…

@wsanchez wsanchez marked this pull request as ready for review February 17, 2021 06:11
Copy link
Member

@adiroiban adiroiban left a 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!

Comment on lines +193 to +194
with:
fetch-depth: 2
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice move :)

Comment on lines +374 to +381
deps = pipdeptree

commands =
pip freeze --exclude={env:PY_MODULE}
python -c 'print()'
pip freeze --exclude="{env:PY_MODULE}"

python -c 'print()'
pipdeptree
Copy link
Member

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]
Copy link
Member

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 :)

Copy link
Member Author

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.

Copy link
Member Author

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.

@wsanchez
Copy link
Member Author

@adiroiban Thanks for the review

@wsanchez wsanchez merged commit 4e6bb27 into master Feb 18, 2021
@wsanchez wsanchez deleted the ci-cleanup branch February 18, 2021 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants