-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to run third-party stubtest on Windows or MacOS when …
…needed (#8923) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
- Loading branch information
1 parent
0f33721
commit 9cd9f6f
Showing
15 changed files
with
129 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Run stubtest | ||
name: Stdlib stubtest | ||
|
||
on: | ||
workflow_dispatch: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Third-party stubtest | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- '**/*.md' | ||
- 'scripts/**' | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
PIP_DISABLE_PIP_VERSION_CHECK: 1 | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
stubtest-third-party: | ||
name: Check third party stubs with stubtest | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
- name: Install dependencies | ||
run: pip install -r requirements-tests.txt | ||
- name: Run stubtest | ||
shell: bash | ||
run: | | ||
STUBS=$( | ||
git diff --name-only origin/${{ github.base_ref }} HEAD | | ||
# Use the daily.yml workflow to run stubtest on all third party stubs | ||
egrep ^stubs/ | cut -d "/" -f 2 | sort -u | (while read stub; do [ -d stubs/$stub ] && echo $stub || true; done) | ||
) | ||
if [ -n "$STUBS" ]; then | ||
echo "Testing $STUBS..." | ||
PACKAGES=$(python tests/get_packages.py $STUBS) | ||
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | ||
if [ -n "$PACKAGES" ]; then | ||
echo "Installing apt packages: $PACKAGES" | ||
sudo apt update && sudo apt install -y $PACKAGES | ||
fi | ||
xvfb-run python tests/stubtest_third_party.py $STUBS | ||
fi | ||
if [ "${{ matrix.os }}" = "macos-latest" ]; then | ||
# Could install brew packages here if we run into stubs that need it | ||
python tests/stubtest_third_party.py $STUBS | ||
fi | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
# Could install choco packages here if we run into stubs that need it | ||
python tests/stubtest_third_party.py $STUBS | ||
fi | ||
else | ||
echo "Nothing to test" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
version = "0.5.*" | ||
|
||
[tool.stubtest] | ||
platforms = ["linux"] | ||
apt_dependencies = ["libjack-dev"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
version = "0.2.*" | ||
|
||
[tool.stubtest] | ||
platforms = ["linux"] | ||
apt_dependencies = ["portaudio19-dev"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
version = "7.45.*" | ||
|
||
[tool.stubtest] | ||
platforms = ["linux"] | ||
apt_dependencies = ["libcurl4-openssl-dev"] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
version = "305.*" | ||
|
||
[tool.stubtest] | ||
platforms = ["win32"] | ||
ignore_missing_stub = false | ||
# The library only works on Windows; we currently only run stubtest on Ubuntu for third-party stubs in CI. | ||
# See #8660 | ||
skip = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import sys | ||
|
||
import tomli | ||
|
||
platform = sys.platform | ||
distributions = sys.argv[1:] | ||
if not distributions: | ||
distributions = os.listdir("stubs") | ||
|
||
metadata_mapping = { | ||
"linux": "apt_dependencies", | ||
# We could add others here if we run into stubs that need it: | ||
# "darwin": "brew_dependencies", | ||
# "win32": "choco_dependencies", | ||
} | ||
|
||
if platform in metadata_mapping: | ||
for distribution in distributions: | ||
with open(f"stubs/{distribution}/METADATA.toml", "rb") as file: | ||
for package in tomli.load(file).get("tool", {}).get("stubtest", {}).get(metadata_mapping[platform], []): | ||
print(package) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters