Skip to content

Move more Travis jobs to GitHub Actions #705

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

Merged
merged 11 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
Expand Down
45 changes: 37 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,36 @@ name: Main
on: [push, pull_request]

jobs:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install tox
run: python -m pip install tox
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel tox
- name: Run linting
run: python -m tox -e lint

types:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to make the types and docs jobs "Required" checks (along with lint and test)? They were implicitly required by Travis.

If so, I don't have permission to do that. Which of the @pypa/twine-maintainers does?

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 they need to run on master before they can be made required?

strategy:
matrix:
python: [3.6, 3.7, 3.8]
Comment on lines +25 to +26
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This duplicates the test matrix. It'd be nice to specify it once, as well as the "latest Python" to use in the other jobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL about YAML anchors and aliases, which are supported by Travis, but not (yet) by GitHub Actions.

There's a discussion thread about how to share matrix between jobs, but the documented configuration seems more complex than it's worth.

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel tox
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This "stanza" duplicated in all jobs, and I haven't looked into ways to DRY it out. There's an open feature request on the setup-python action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

- name: Run type-checking
run: python -m tox -e types

test:
strategy:
matrix:
Expand All @@ -24,12 +41,24 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: "Install dependencies"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel tox
- name: Run tests
run: python -m tox -e py # Run tox using the version of Python in `PATH`
run: python -m tox -e py # Use the version of Python in $PATH

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel tox
Copy link
Member

Choose a reason for hiding this comment

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

Can we add .github/actions/requirements.txt with these and run python -m pip install --upgrade -r .github/actions/requirements.txt instead? That way all of these are less duplicated? Helps when we move to something else and might be a decent pattern to upstream to the python action

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that idea, but it got me thinking that it would be sufficient (if not preferred) to let tox manage the versions of pip, setuptools, and wheel, so in 7c65ce6 this has been reduced to pip install tox.

The output of pip list shows that the testenvs are using the latest versions, but if we want more control in the future, we can use the requires and download options in tox.ini (with the caveat that there's an open issue re: download = true.

- name: Build docs
run: python -m tox -e docs
21 changes: 0 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,6 @@ matrix:

include:
- python: &latest_py3 3.8
- python: 3.7
- python: &oldest_py3 3.6

- python: 3.7
name: Linting code style
env:
TOXENV: lint

- python: *latest_py3
name: Checking type annotations (latest Python)
env:
TOXENV: types
- python: *oldest_py3
name: Checking type annotations (oldest Python)
env:
TOXENV: types

- python: 3.7
name: Making sure that docs build is healthy
env:
TOXENV: docs

- stage: deploy
if: tag IS present
Expand Down