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

Test sdist contents instead of Git checkout in CI #2541

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
96 changes: 90 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,78 @@ concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && format('-{0}', github.sha) || '' }}
cancel-in-progress: true

env:
dists-artifact-name: python-package-distributions
dist-name: trio

jobs:
build:
name: 👷 dists

runs-on: ubuntu-latest

outputs:
dist-version: ${{ steps.dist-version.outputs.version }}
sdist-artifact-name: ${{ steps.artifact-name.outputs.sdist }}
wheel-artifact-name: ${{ steps.artifact-name.outputs.wheel }}

steps:
- name: Switch to using Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Grab the source from Git
uses: actions/checkout@v3

- name: Get the dist version
id: dist-version
run: >-
echo "version=$(
grep ^__version__ trio/_version.py
| sed 's/__version__ = "\([^"]\+\)"/\1/'
)"
>> "${GITHUB_OUTPUT}"

- name: Set the expected dist artifact names
id: artifact-name
run: |
echo 'sdist=${{ env.dist-name }}-*.tar.gz' >> "${GITHUB_OUTPUT}"
echo 'wheel=${{
env.dist-name
}}-*-py3-none-any.whl' >> "${GITHUB_OUTPUT}"

- name: Install build
run: >-
python -m
pip install
--user
'build ~= 0.10.0'

- name: Build dists
run: python -m build
- name: Verify that the artifacts with expected names got created
run: >-
ls -1
dist/${{ steps.artifact-name.outputs.sdist }}
dist/${{ steps.artifact-name.outputs.wheel }}
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: ${{ env.dists-artifact-name }}
# NOTE: Exact expected file names are specified here
# NOTE: as a safety measure — if anything weird ends
# NOTE: up being in this dir or not all dists will be
# NOTE: produced, this will fail the workflow.
path: |
dist/${{ steps.artifact-name.outputs.sdist }}
dist/${{ steps.artifact-name.outputs.wheel }}
retention-days: 5
Windows:
name: 'Windows (${{ matrix.python }}, ${{ matrix.arch }}${{ matrix.extra_name }})'
needs:
- build

timeout-minutes: 20
runs-on: 'windows-latest'
strategy:
Expand Down Expand Up @@ -54,8 +123,11 @@ jobs:
|| false
}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
with:
source-tarball-name: ${{ needs.build.outputs.sdist-artifact-name }}
workflow-artifact-name: ${{ env.dists-artifact-name }}
- name: Setup python
uses: actions/setup-python@v4
with:
Expand Down Expand Up @@ -86,6 +158,9 @@ jobs:

Ubuntu:
name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
needs:
- build

timeout-minutes: 10
runs-on: 'ubuntu-latest'
strategy:
Expand All @@ -109,8 +184,11 @@ jobs:
|| false
}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
with:
source-tarball-name: ${{ needs.build.outputs.sdist-artifact-name }}
workflow-artifact-name: ${{ env.dists-artifact-name }}
- name: Setup python
uses: actions/setup-python@v4
if: "!endsWith(matrix.python, '-dev')"
Expand All @@ -136,6 +214,9 @@ jobs:

macOS:
name: 'macOS (${{ matrix.python }})'
needs:
- build

timeout-minutes: 15
runs-on: 'macos-latest'
strategy:
Expand All @@ -152,8 +233,11 @@ jobs:
|| false
}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Retrieve the project source from an sdist inside the GHA artifact
uses: re-actors/checkout-python-sdist@release/v1
with:
source-tarball-name: ${{ needs.build.outputs.sdist-artifact-name }}
workflow-artifact-name: ${{ env.dists-artifact-name }}
- name: Setup python
uses: actions/setup-python@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
include .coveragerc
include check.sh
include ci.sh
include LICENSE LICENSE.MIT LICENSE.APACHE2
include mypy.ini
include README.rst
include CODE_OF_CONDUCT.md CONTRIBUTING.md
include test-requirements.txt
include trio/_tests/astrill-codesigning-cert.cer
recursive-include trio/_tests/test_ssl_certs *.pem
recursive-include docs *
prune docs/build