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

#11628 Run Windows CI tests on GitHub Actions. #11629

Merged
merged 14 commits into from Sep 1, 2022
Merged

Conversation

adiroiban
Copy link
Member

@adiroiban adiroiban commented Aug 30, 2022

Scope and purpose

Fixes #11628

See inline comments.

Besides enabling the Windows tests I have also enabled tmate to allow debugging Windows.

This is the main reason why I have moved the Windows tests to GHA.

@adiroiban adiroiban force-pushed the 11628-win-ci-on-gha branch 2 times, most recently from 701c4c8 to eed44da Compare August 30, 2022 18:20
Copy link
Member Author

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

I think this is ready for an initial review

A previous run at https://github.com/twisted/twisted/runs/8099083260?check_suite_focus=true

needs-review

.github/workflows/test.yaml Show resolved Hide resolved
# Set to 'yes' to open a tunnel to GitHub's VMs through tmate on failures.
# Also increase timeout-minutes for the relevant OS when debugging remotely
# and you need a longer session.
TMATE_DEBUG: 'no'
Copy link
Member Author

Choose a reason for hiding this comment

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

We only want to enable tmate when we are to start a debug session...and not on any failure.

tmate is only triggered on failure

runs-on: ubuntu-20.04
name: ${{ matrix.python-version }}-${{ matrix.job-name || 'lnx-default-tests' }}
# We have Ubuntu as the base for running agains multiple Python versions.
runs-on: "${{ matrix.runs-on || 'ubuntu-20.04'}}"
Copy link
Member Author

Choose a reason for hiding this comment

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

the 'ubuntu-20.04' is not explicitly defined in the matrix so that we don't have to repeat it each time we extend it.

We leave it empty and use a default value.

Another option is to define the default values via global environment variables.

env:
   DEFAULT_RUNS_ON: 'ubuntu-22.04'
jobs:
  testing:
    runs-on: "${{ matrix.runs-on || 'env.DEFAULT_RUNS_ON'}}"

azure-pipelines/run_test_steps.yml Show resolved Hide resolved
tox.ini Show resolved Hide resolved
@adiroiban
Copy link
Member Author

please review

@chevah-robot chevah-robot requested a review from a team August 30, 2022 18:47
@exarkun exarkun self-assigned this Aug 30, 2022
Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

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

Thanks (and for talking me through it on IRC too)! This looks like a great start. I pointed out a few minor things inline.

@@ -1,5 +1,9 @@
# Try to get a short workflow name and a job name that start with Python
# version to make it easier to check the status inside GitHub UI.
#
# When using external actions check that the extenral repos are permitted via
Copy link
Member

Choose a reason for hiding this comment

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

typo in "external" here

.github/workflows/test.yaml Show resolved Hide resolved
tox.ini Show resolved Hide resolved
azure-pipelines/run_test_steps.yml Show resolved Hide resolved

jobs:
testing:
runs-on: ubuntu-20.04
name: ${{ matrix.python-version }}-${{ matrix.job-name || 'lnx-default-tests' }}
Copy link
Member

Choose a reason for hiding this comment

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

I think "linux" will be more clear in the UI than "lnx" and I don't think the extra 2 letters will make the names so long it becomes a problem.

@@ -48,14 +72,34 @@ jobs:
tox-wrapper: ['']
# Tests are executed with the default target which is the full test suite.
trial-target: ['']
# By default the coverate is not skipped.
Copy link
Member

Choose a reason for hiding this comment

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

Typo in "coverage" here

trial-target: twisted.test.test_compat twisted.test.test_defer twisted.internet.test.test_socket twisted.trial.test.test_tests
job-name: 'pypy-coverage'
Copy link
Member

Choose a reason for hiding this comment

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

We get some redundancy in the name from this - eg "pypy-3.7-alldeps-nocov-posix". Maybe 'coverage' would be better?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. I went for explicit 'with-coverage'

@@ -139,8 +191,15 @@ jobs:
run: |
${{ matrix.tox-wrapper }} tox ${{ matrix.trial-target }}

# If one of the above steps fails, fire up tmate for remote debugging.
- name: Tmate debug on failure
if: ${{ !cancelled() && env.TMATE_DEBUG == 'yes' }}
Copy link
Member

Choose a reason for hiding this comment

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

The workflow for using this action, then, will be to change TMATE_DEBUG at the top of the file to 'yes' and re-run the build, then change it back to 'no' again afterwards?

I guess there's a good reason not to have it turned on all the time? https://github.com/mxschmitt/action-tmate#manually-triggered-debug looks like a slightly nicer workflow, maybe it's not too much more work to do it that way?

Copy link
Member Author

Choose a reason for hiding this comment

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

For me, editing the text was easier than using the Github action manual workflow trigger.

It is true that you can forget to set it back to no afterward.


You don't want it turned on all the time, as then on failure it will "hang" and wait for someone to connect via SSH.


I will push a commit that will also add manual triggers.
Not sure what are the permissions for manual triggers... that is, if you can trigger from a fork.

.github/workflows/test.yaml Show resolved Hide resolved
.github/workflows/test.yaml Show resolved Hide resolved
@adiroiban
Copy link
Member Author

I hope I have addressed all the comments.

please review

@chevah-robot chevah-robot requested a review from a team August 30, 2022 20:19
Copy link
Member

@exarkun exarkun left a comment

Choose a reason for hiding this comment

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

Thanks! This looks quite good. I left some minor suggestions inline. Take them if you like.

One thing I was not able to do was convince myself that 3.7-win-default-tests-select is actually running the tests against Python 3.7 and 3.10-win-default-tests-iocp is testing with Python 3.10. Can you point at anything in the logs that reveals this? Or maybe add something to the CI jobs somewhere that makes this clear. Then I'm happy to see this merged.

.github/workflows/test.yaml Outdated Show resolved Hide resolved
.github/workflows/test.yaml Outdated Show resolved Hide resolved
Comment on lines 144 to 145
- python-version: pypy-3.7
tox-env: alldeps-nocov-posix
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- python-version: pypy-3.7
tox-env: alldeps-nocov-posix
- python-version: 'pypy-3.7'
tox-env: 'alldeps-nocov-posix'

Comment on lines 151 to 152
- python-version: pypy-3.7
tox-env: alldeps-withcov-posix
trial-target: twisted.test.test_compat twisted.test.test_defer twisted.internet.test.test_socket twisted.trial.test.test_tests
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- python-version: pypy-3.7
tox-env: alldeps-withcov-posix
trial-target: twisted.test.test_compat twisted.test.test_defer twisted.internet.test.test_socket twisted.trial.test.test_tests
- python-version: 'pypy-3.7'
trial-target: 'twisted.test.test_compat twisted.test.test_defer twisted.internet.test.test_socket twisted.trial.test.test_tests'

.github/workflows/test.yaml Outdated Show resolved Hide resolved
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
Copy link
Member

Choose a reason for hiding this comment

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

Cool. No doubt the only way to know if this actually works is to merge the PR and then try clicking buttons on GitHub Actions ... I'll certainly try that out as soon as this lands.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The GitHub UI is updated only after merge.

But you try the TMATE_DEBUG: 'yes' version.
That version is also ok for debugging the process itself.
So if the UI trigger doesn't work, you can force tmate.

@adiroiban
Copy link
Member Author

Thanks for the review. I will get this merged.

I saw a codecov failure ... so macOS should be next, and then try to run coverage report on GHA.

When tox runs, in any environment, local or remote-ci you will see the python version

See the link https://github.com/twisted/twisted/runs/8102345847?check_suite_focus=true#step:10:36

tox code at

twisted/tox.ini

Lines 86 to 91 in 26c3c04

commands =
;
; Display information about Python interpreter
; which will be used in subsequent steps
;
python {toxinidir}/admin/dump_all_version_info.py

Local run is something like this

$ tox -e alldeps-nocov 
alldeps-nocov wheel-make: cleaning up build directory ...
alldeps-nocov wheel-make: commands[0] | pip wheel /home/adi/chevah/twisted --no-deps --use-pep517 --wheel-dir /home/adi/chevah/twisted/.tox/dist
Processing /home/adi/chevah/twisted
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: Twisted
  Building wheel for Twisted (pyproject.toml) ... done
  Created wheel for Twisted: filename=Twisted-22.4.0.post0-py3-none-any.whl size=3102521 
- [SNIP}
alldeps-nocov run-test-pre: PYTHONHASHSEED='544835508'
alldeps-nocov run-test: commands[0] | python /home/adi/chevah/twisted/admin/dump_all_version_info.py
+::group::Python info
+/home/adi/chevah/twisted/.tox/alldeps-nocov
+/home/adi/chevah/twisted/.tox/alldeps-nocov
+/home/adi/chevah/twisted/.tox/alldeps-nocov/bin/python
+3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
+linux
+::endgroup::
alldeps-nocov run-test: commands[1] | python -m twisted.trial --temp-directory=/home/adi/chevah/twisted/.tox/alldeps-nocov/tmp/_trial_temp --reporter=verbose twisted

Comment on lines 139 to 145

# On PYPY coverage is very slow (5min vs 30min) as there is no C
# extension.
# There is very little PYPY specific code so there is not much to
# gain from reporting coverage.
- python-version: pypy-3.7
tox-env: alldeps-nocov-posix
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
# On PYPY coverage is very slow (5min vs 30min) as there is no C
# extension.
# There is very little PYPY specific code so there is not much to
# gain from reporting coverage.
- python-version: pypy-3.7
tox-env: alldeps-nocov-posix
# On PYPY coverage is very slow (5min vs 30min) as there is no C
# extension.
# There is very little PYPY specific code so there is not much to
# gain from reporting coverage.
- python-version: 'pypy-3.7'
tox-env: 'alldeps-nocov-posix'

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. This goes to the "delete-lines" and can't be applied by github.
Will manually apply it.

adiroiban and others added 2 commits September 1, 2022 11:08
Co-authored-by: Jean-Paul Calderone <exarkun@twistedmatrix.com>
@adiroiban adiroiban merged commit f4c9fbe into trunk Sep 1, 2022
@adiroiban adiroiban deleted the 11628-win-ci-on-gha branch September 1, 2022 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run Windows tests on GitHub Actions
3 participants