Skip to content
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
32 changes: 32 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint GitHub Actions workflows

on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/workflows/**"
pull_request:
paths:
- ".github/workflows/**"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Run actionlint
# The official image includes ShellCheck and Pyflakes.
uses: docker://rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
with:
args: -color -verbose
19 changes: 13 additions & 6 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,28 @@ jobs:
shell: bash
run: |
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
PACKAGE_ARGS=()
while IFS= read -r package; do
PACKAGE_ARGS+=("$package")
done <<< "$PACKAGES"

if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
printf 'Installing APT packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
sudo apt-get update -q && sudo apt-get install -qy "${PACKAGE_ARGS[@]}"
fi
else
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
brew install -q $PACKAGES
printf 'Installing Homebrew packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
brew install -q "${PACKAGE_ARGS[@]}"
fi

if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
choco install -y $PACKAGES
printf 'Installing Chocolatey packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
choco install -y "${PACKAGE_ARGS[@]}"
fi
fi
- name: Run stubtest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mypy_primer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
cd typeshed_to_test
MYPY_VERSION=$(grep mypy== requirements-tests.txt | cut -d = -f 3)
echo "new commit"
git rev-list --format=%s --max-count=1 $GITHUB_SHA
git rev-list --format=%s --max-count=1 "$GITHUB_SHA"
git checkout -b upstream_main origin/main
echo "base commit"
git rev-list --format=%s --max-count=1 upstream_main
Expand All @@ -50,9 +50,9 @@ jobs:
# fail action if exit code isn't zero or one
(
mypy_primer \
--new v${MYPY_VERSION} --old v${MYPY_VERSION} \
--new "v${MYPY_VERSION}" --old "v${MYPY_VERSION}" \
--custom-typeshed-repo typeshed_to_test \
--new-typeshed $GITHUB_SHA --old-typeshed upstream_main \
--new-typeshed "$GITHUB_SHA" --old-typeshed upstream_main \
--num-shards 6 --shard-index ${{ matrix.shard-index }} \
--debug \
--output concise \
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/stubtest_third_party.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,39 @@ jobs:
# Use the daily.yml workflow to run stubtest on all third party stubs.
function find_stubs {
git diff --name-only "origin/${GITHUB_BASE_REF}" HEAD | \
egrep ^stubs/ | cut -d "/" -f 2 | sort -u | \
(while read stub; do [ -d "stubs/$stub" ] && echo -n "$stub " || true; done)
grep -E ^stubs/ | cut -d "/" -f 2 | sort -u | \
(while IFS= read -r stub; do [ -d "stubs/$stub" ] && echo -n "$stub " || true; done)
}
STUBS=$(find_stubs || echo '')
echo "Changed stubs: $STUBS"
echo "STUBS=$STUBS" >> $GITHUB_ENV
echo "STUBS=$STUBS" >> "$GITHUB_ENV"
- name: Install required system packages
shell: bash
run: |
if [ -n "$STUBS" ]; then
PACKAGES=$(python tests/get_stubtest_system_requirements.py $STUBS)
read -r -a STUB_ARGS <<< "$STUBS"
PACKAGES=$(python tests/get_stubtest_system_requirements.py "${STUB_ARGS[@]}")
PACKAGE_ARGS=()
while IFS= read -r package; do
PACKAGE_ARGS+=("$package")
done <<< "$PACKAGES"
if [ "${{ runner.os }}" = "Linux" ]; then
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
printf 'Installing APT packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
sudo apt-get update -q && sudo apt-get install -qy "${PACKAGE_ARGS[@]}"
fi
else
if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then
printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
brew install -q $PACKAGES
printf 'Installing Homebrew packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
brew install -q "${PACKAGE_ARGS[@]}"
fi

if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then
printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
choco install -y $PACKAGES
printf 'Installing Chocolatey packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
choco install -y "${PACKAGE_ARGS[@]}"
fi
fi
fi
Expand All @@ -89,14 +97,15 @@ jobs:
run: |
if [ -n "$STUBS" ]; then
echo "Testing $STUBS..."
read -r -a STUB_ARGS <<< "$STUBS"

if [ "${{ runner.os }}" = "Linux" ]; then
PYTHON_EXECUTABLE="xvfb-run python"
else
PYTHON_EXECUTABLE="python"
fi

$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only $STUBS
$PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only "${STUB_ARGS[@]}"
else
echo "Nothing to test"
fi
41 changes: 32 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ jobs:
run: |
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
PACKAGE_ARGS=()
while IFS= read -r package; do
PACKAGE_ARGS+=("$package")
done <<< "$PACKAGES"
printf 'Installing APT packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
sudo apt-get update -q && sudo apt-get install -qy "${PACKAGE_ARGS[@]}"
fi
- name: Run mypy_test.py
run: python ./tests/mypy_test.py --platform=${{ matrix.platform }} --python-version=${{ matrix.python-version }}
Expand Down Expand Up @@ -117,7 +122,11 @@ jobs:
run: |
PACKAGES=$(python tests/get_external_stub_requirements.py)
if [ -n "$PACKAGES" ]; then
uv pip install --python-version ${{ matrix.python-version }} $PACKAGES
PACKAGE_ARGS=()
while IFS= read -r package; do
PACKAGE_ARGS+=("$package")
done <<< "$PACKAGES"
uv pip install --python-version ${{ matrix.python-version }} "${PACKAGE_ARGS[@]}"
fi
# Published stub packages can shadow the checked-in stubs when ty
# resolves their relative imports.
Expand Down Expand Up @@ -152,7 +161,11 @@ jobs:
run: |
PACKAGES=$(python tests/get_external_stub_requirements.py)
if [ -n "$PACKAGES" ]; then
uv pip install --python-version ${{ matrix.python-version }} $PACKAGES
PACKAGE_ARGS=()
while IFS= read -r package; do
PACKAGE_ARGS+=("$package")
done <<< "$PACKAGES"
uv pip install --python-version ${{ matrix.python-version }} "${PACKAGE_ARGS[@]}"
fi
# Published stub packages can shadow the checked-in stubs when pyrefly
# resolves their relative imports.
Expand Down Expand Up @@ -187,20 +200,30 @@ jobs:
run: |
PACKAGES=$(python tests/get_stubtest_system_requirements.py)
if [ -n "$PACKAGES" ]; then
printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
sudo apt-get update -q && sudo apt-get install -qy $PACKAGES
PACKAGE_ARGS=()
while IFS= read -r package; do
PACKAGE_ARGS+=("$package")
done <<< "$PACKAGES"
printf 'Installing APT packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
sudo apt-get update -q && sudo apt-get install -qy "${PACKAGE_ARGS[@]}"
fi
- name: Create an isolated venv for testing
run: uv venv .venv
- name: Install 3rd-party stub dependencies
run: |
PACKAGES=$(python tests/get_external_stub_requirements.py)
if [ -n "$PACKAGES" ]; then
printf "Installing python packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n"
uv pip install --python-version ${{ matrix.python-version }} $PACKAGES
PACKAGE_ARGS=()
while IFS= read -r package; do
PACKAGE_ARGS+=("$package")
done <<< "$PACKAGES"
printf 'Installing python packages:\n'
printf ' %s\n' "${PACKAGE_ARGS[@]}"
uv pip install --python-version ${{ matrix.python-version }} "${PACKAGE_ARGS[@]}"
fi
- name: Activate the isolated venv for the rest of the job
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
run: echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
- name: List 3rd-party stub dependencies installed
run: uv pip freeze
- name: Run pyright with basic settings on all the stubs
Expand Down
Loading