Repository navigation
Add actionlint checks for GitHub Actions #16316
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
Changes from 5 commits
c0f0db2
aacbf3f
3138e91
95acecb
d33800d
d7ac441
0a36c86
6611c6c
7851964
5281dc2
4835091
b52f6e0
fc05e21
fca65d4
c7f6710
a782bb5
df09499
1f82392
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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. | ||
|
AlexWaygood marked this conversation as resolved.
Resolved
|
||
| uses: docker://rhysd/actionlint:1.7.12@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 | ||
| with: | ||
| args: -color -verbose | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this? I assume this was flagged due to white space handling. But since package names can not contain white space, I think this only complicates the action unnecessarily and makes it harder to understand and verify its correctness. (Same pattern a few times below.)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, there were a huge number of SC2086 errors reported on our workflows: DetailsI'm reverting most of the changes you're talking about; I agree they made things less readable for a purely theoretical problem. Sorry about that. |
||
|
|
||
| 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 }} | ||
|
|
@@ -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. | ||
|
Comment on lines
120
to
130
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @srittau -- codex reckons that the shellcheck diagnostic here (and for other places where we use
|
||
|
|
@@ -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. | ||
|
|
@@ -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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.