| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6b4b7d3 commit 80804c0
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,36 @@ | |||
| 1 | + name: Lint GitHub Actions workflows | ||
| 2 | + | ||
| 3 | + on: | ||
| 4 | + workflow_dispatch: | ||
| 5 | + push: | ||
| 6 | + branches: | ||
| 7 | + - main | ||
| 8 | + paths: | ||
| 9 | + - ".github/workflows/**" | ||
| 10 | + pull_request: | ||
| 11 | + paths: | ||
| 12 | + - ".github/workflows/**" | ||
| 13 | + | ||
| 14 | + permissions: | ||
| 15 | + contents: read | ||
| 16 | + | ||
| 17 | + concurrency: | ||
| 18 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
| 19 | + cancel-in-progress: true | ||
| 20 | + | ||
| 21 | + jobs: | ||
| 22 | + actionlint: | ||
| 23 | + runs-on: ubuntu-latest | ||
| 24 | + steps: | ||
| 25 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| 26 | + with: | ||
| 27 | + persist-credentials: false | ||
| 28 | + - name: Run actionlint | ||
| 29 | + # This is the recommended way to run actionlint in CI: | ||
| 30 | + # https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions. | ||
| 31 | + # The actionlint pre-commit hook would be an alternative, | ||
| 32 | + # but it causes our pre-commit CI jobs to time out. | ||
| 33 | + # The Docker image includes ShellCheck and Pyflakes. | ||
| 34 | + uses: docker://rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 | ||
| 35 | + with: | ||
| 36 | + args: -color -verbose | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,19 +86,24 @@ jobs: | |||
| 86 | 86 | run: | | |
| 87 | 87 | PACKAGES=$(python tests/get_stubtest_system_requirements.py) | |
| 88 | 88 | ||
| 89 | + # System package names contain no whitespace or glob characters, so word splitting is intentional. | ||
| 90 | + # shellcheck disable=SC2086 | ||
| 89 | 91 | if [ "${{ runner.os }}" = "Linux" ]; then | |
| 90 | 92 | if [ -n "$PACKAGES" ]; then | |
| 91 | - printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 93 | + printf 'Installing APT packages:\n' | ||
| 94 | + printf ' %s\n' $PACKAGES | ||
| 92 | 95 | sudo apt-get update -q && sudo apt-get install -qy $PACKAGES | |
| 93 | 96 | fi | |
| 94 | 97 | else | |
| 95 | 98 | if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then | |
| 96 | - printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 99 | + printf 'Installing Homebrew packages:\n' | ||
| 100 | + printf ' %s\n' $PACKAGES | ||
| 97 | 101 | brew install -q $PACKAGES | |
| 98 | 102 | fi | |
| 99 | 103 | ||
| 100 | 104 | if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then | |
| 101 | - printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 105 | + printf 'Installing Chocolatey packages:\n' | ||
| 106 | + printf ' %s\n' $PACKAGES | ||
| 102 | 107 | choco install -y $PACKAGES | |
| 103 | 108 | fi | |
| 104 | 109 | fi | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,7 +41,7 @@ jobs: | |||
| 41 | 41 | cd typeshed_to_test | |
| 42 | 42 | MYPY_VERSION=$(grep mypy== requirements-tests.txt | cut -d = -f 3) | |
| 43 | 43 | echo "new commit" | |
| 44 | - git rev-list --format=%s --max-count=1 $GITHUB_SHA | ||
| 44 | + git rev-list --format=%s --max-count=1 "$GITHUB_SHA" | ||
| 45 | 45 | git checkout -b upstream_main origin/main | |
| 46 | 46 | echo "base commit" | |
| 47 | 47 | git rev-list --format=%s --max-count=1 upstream_main | |
@@ -50,9 +50,9 @@ jobs: | |||
| 50 | 50 | # fail action if exit code isn't zero or one | |
| 51 | 51 | ( | |
| 52 | 52 | mypy_primer \ | |
| 53 | - --new v${MYPY_VERSION} --old v${MYPY_VERSION} \ | ||
| 53 | + --new "v${MYPY_VERSION}" --old "v${MYPY_VERSION}" \ | ||
| 54 | 54 | --custom-typeshed-repo typeshed_to_test \ | |
| 55 | - --new-typeshed $GITHUB_SHA --old-typeshed upstream_main \ | ||
| 55 | + --new-typeshed "$GITHUB_SHA" --old-typeshed upstream_main \ | ||
| 56 | 56 | --num-shards 6 --shard-index ${{ matrix.shard-index }} \ | |
| 57 | 57 | --debug \ | |
| 58 | 58 | --output concise \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,30 +56,35 @@ jobs: | |||
| 56 | 56 | # Use the daily.yml workflow to run stubtest on all third party stubs. | |
| 57 | 57 | function find_stubs { | |
| 58 | 58 | git diff --name-only "origin/${GITHUB_BASE_REF}" HEAD | \ | |
| 59 | - egrep ^stubs/ | cut -d "/" -f 2 | sort -u | \ | ||
| 60 | - (while read stub; do [ -d "stubs/$stub" ] && echo -n "$stub " || true; done) | ||
| 59 | + grep -E ^stubs/ | cut -d "/" -f 2 | sort -u | \ | ||
| 60 | + (while IFS= read -r stub; do [ -d "stubs/$stub" ] && echo -n "$stub " || true; done) | ||
| 61 | 61 | } | |
| 62 | 62 | STUBS=$(find_stubs || echo '') | |
| 63 | 63 | echo "Changed stubs: $STUBS" | |
| 64 | - echo "STUBS=$STUBS" >> $GITHUB_ENV | ||
| 64 | + echo "STUBS=$STUBS" >> "$GITHUB_ENV" | ||
| 65 | 65 | - name: Install required system packages | |
| 66 | 66 | shell: bash | |
| 67 | 67 | run: | | |
| 68 | + # System package and stub directory names contain no whitespace or glob characters; split both lists into arguments. | ||
| 69 | + # shellcheck disable=SC2086 | ||
| 68 | 70 | if [ -n "$STUBS" ]; then | |
| 69 | 71 | PACKAGES=$(python tests/get_stubtest_system_requirements.py $STUBS) | |
| 70 | 72 | if [ "${{ runner.os }}" = "Linux" ]; then | |
| 71 | 73 | if [ -n "$PACKAGES" ]; then | |
| 72 | - printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 74 | + printf 'Installing APT packages:\n' | ||
| 75 | + printf ' %s\n' $PACKAGES | ||
| 73 | 76 | sudo apt-get update -q && sudo apt-get install -qy $PACKAGES | |
| 74 | 77 | fi | |
| 75 | 78 | else | |
| 76 | 79 | if [ "${{ runner.os }}" = "macOS" ] && [ -n "$PACKAGES" ]; then | |
| 77 | - printf "Installing Homebrew packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 80 | + printf 'Installing Homebrew packages:\n' | ||
| 81 | + printf ' %s\n' $PACKAGES | ||
| 78 | 82 | brew install -q $PACKAGES | |
| 79 | 83 | fi | |
| 80 | 84 | ||
| 81 | 85 | if [ "${{ runner.os }}" = "Windows" ] && [ -n "$PACKAGES" ]; then | |
| 82 | - printf "Installing Chocolatey packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 86 | + printf 'Installing Chocolatey packages:\n' | ||
| 87 | + printf ' %s\n' $PACKAGES | ||
| 83 | 88 | choco install -y $PACKAGES | |
| 84 | 89 | fi | |
| 85 | 90 | fi | |
@@ -96,6 +101,8 @@ jobs: | |||
| 96 | 101 | PYTHON_EXECUTABLE="python" | |
| 97 | 102 | fi | |
| 98 | 103 | ||
| 104 | + # Stub directory names contain no whitespace or glob characters, so word splitting is intentional. | ||
| 105 | + # shellcheck disable=SC2086 | ||
| 99 | 106 | $PYTHON_EXECUTABLE tests/stubtest_third_party.py --ci-platforms-only $STUBS | |
| 100 | 107 | else | |
| 101 | 108 | echo "Nothing to test" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,8 +63,11 @@ jobs: | |||
| 63 | 63 | - name: Install required APT packages | |
| 64 | 64 | run: | | |
| 65 | 65 | PACKAGES=$(python tests/get_stubtest_system_requirements.py) | |
| 66 | + # System package names contain no whitespace or glob characters, so word splitting is intentional. | ||
| 67 | + # shellcheck disable=SC2086 | ||
| 66 | 68 | if [ -n "$PACKAGES" ]; then | |
| 67 | - printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 69 | + printf 'Installing APT packages:\n' | ||
| 70 | + printf ' %s\n' $PACKAGES | ||
| 68 | 71 | sudo apt-get update -q && sudo apt-get install -qy $PACKAGES | |
| 69 | 72 | fi | |
| 70 | 73 | - name: Run mypy_test.py | |
@@ -117,7 +120,11 @@ jobs: | |||
| 117 | 120 | run: | | |
| 118 | 121 | PACKAGES=$(python tests/get_external_stub_requirements.py) | |
| 119 | 122 | if [ -n "$PACKAGES" ]; then | |
| 120 | - uv pip install --python-version ${{ matrix.python-version }} $PACKAGES | ||
| 123 | + PACKAGE_ARGS=() | ||
| 124 | + while IFS= read -r package; do | ||
| 125 | + PACKAGE_ARGS+=("$package") | ||
| 126 | + done <<< "$PACKAGES" | ||
| 127 | + uv pip install --python-version ${{ matrix.python-version }} "${PACKAGE_ARGS[@]}" | ||
| 121 | 128 | fi | |
| 122 | 129 | # Published stub packages can shadow the checked-in stubs when ty | |
| 123 | 130 | # resolves their relative imports. | |
@@ -152,7 +159,11 @@ jobs: | |||
| 152 | 159 | run: | | |
| 153 | 160 | PACKAGES=$(python tests/get_external_stub_requirements.py) | |
| 154 | 161 | if [ -n "$PACKAGES" ]; then | |
| 155 | - uv pip install --python-version ${{ matrix.python-version }} $PACKAGES | ||
| 162 | + PACKAGE_ARGS=() | ||
| 163 | + while IFS= read -r package; do | ||
| 164 | + PACKAGE_ARGS+=("$package") | ||
| 165 | + done <<< "$PACKAGES" | ||
| 166 | + uv pip install --python-version ${{ matrix.python-version }} "${PACKAGE_ARGS[@]}" | ||
| 156 | 167 | fi | |
| 157 | 168 | # Published stub packages can shadow the checked-in stubs when pyrefly | |
| 158 | 169 | # resolves their relative imports. | |
@@ -186,8 +197,11 @@ jobs: | |||
| 186 | 197 | - name: Install required APT packages | |
| 187 | 198 | run: | | |
| 188 | 199 | PACKAGES=$(python tests/get_stubtest_system_requirements.py) | |
| 200 | + # System package names contain no whitespace or glob characters, so word splitting is intentional. | ||
| 201 | + # shellcheck disable=SC2086 | ||
| 189 | 202 | if [ -n "$PACKAGES" ]; then | |
| 190 | - printf "Installing APT packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 203 | + printf 'Installing APT packages:\n' | ||
| 204 | + printf ' %s\n' $PACKAGES | ||
| 191 | 205 | sudo apt-get update -q && sudo apt-get install -qy $PACKAGES | |
| 192 | 206 | fi | |
| 193 | 207 | - name: Create an isolated venv for testing | |
@@ -196,11 +210,16 @@ jobs: | |||
| 196 | 210 | run: | | |
| 197 | 211 | PACKAGES=$(python tests/get_external_stub_requirements.py) | |
| 198 | 212 | if [ -n "$PACKAGES" ]; then | |
| 199 | - printf "Installing python packages:\n $(echo $PACKAGES | sed 's/ /\n /g')\n" | ||
| 200 | - uv pip install --python-version ${{ matrix.python-version }} $PACKAGES | ||
| 213 | + PACKAGE_ARGS=() | ||
| 214 | + while IFS= read -r package; do | ||
| 215 | + PACKAGE_ARGS+=("$package") | ||
| 216 | + done <<< "$PACKAGES" | ||
| 217 | + printf 'Installing python packages:\n' | ||
| 218 | + printf ' %s\n' "${PACKAGE_ARGS[@]}" | ||
| 219 | + uv pip install --python-version ${{ matrix.python-version }} "${PACKAGE_ARGS[@]}" | ||
| 201 | 220 | fi | |
| 202 | 221 | - name: Activate the isolated venv for the rest of the job | |
| 203 | - run: echo "$PWD/.venv/bin" >> $GITHUB_PATH | ||
| 222 | + run: echo "$PWD/.venv/bin" >> "$GITHUB_PATH" | ||
| 204 | 223 | - name: List 3rd-party stub dependencies installed | |
| 205 | 224 | run: uv pip freeze | |
| 206 | 225 | - name: Run pyright with basic settings on all the stubs | |
| Back | FazBrowse Home | New Git URL |
0 commit comments