CI: Add separate Lint&Tidy check and remove test-tidy from linux (#33150)

* Create separate Lint&Tidy check

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Remove quick-check as it's not longer relevant

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Add clippy to rust-toolchain

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* fix try parser test expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* use lint in result

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Lint & Tidy -> Lint

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
Signed-off-by: Samson <16504129+sagudev@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Samson 2024-08-23 10:58:12 +02:00 committed by GitHub
parent 0afcb83e9f
commit ebdae6094e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 100 additions and 79 deletions

View file

@ -50,20 +50,12 @@ jobs:
fetch-depth: 2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip virtualenv
- name: Bootstrap dependencies
run: sudo apt update && python3 ./mach bootstrap
run: sudo apt update && python3 ./mach bootstrap --skip-lints
- name: Set up JDK 17
uses: actions/setup-java@v4
with:

View file

@ -50,6 +50,12 @@ jobs:
unit-tests: ${{ inputs.unit-tests }}
wpt-args: ${{ inputs.wpt-args }}
lint:
if: ${{ inputs.workflow == 'lint' }}
name: Lint
uses: ./.github/workflows/lint.yml
secrets: inherit
android:
if: ${{ inputs.workflow == 'android' }}
name: Android

59
.github/workflows/lint.yml vendored Normal file
View file

@ -0,0 +1,59 @@
name: Lint
on:
workflow_call:
workflow_dispatch:
env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 2 # This is necessary for `test-tidy`.
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2 # This is necessary for `test-tidy`.
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
run: echo "LIBCLANG_PATH=/usr/lib/llvm-14/lib" >> $GITHUB_ENV
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip
- name: Bootstrap dependencies
run: |
sudo apt update
python3 ./mach bootstrap
# TODO: Do GitHub anotaions
# TODO: Fail on warnings
- name: Clippy
run: |
python3 ./mach cargo-clippy --use-crown --locked
- name: Tidy
run: python3 ./mach test-tidy --no-progress --all

View file

@ -74,15 +74,12 @@ jobs:
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 2 # This is necessary for `test-tidy`.
# This is necessary to checkout the pull request if this run was triggered via a
# `pull_request_target` event.
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2 # This is necessary for `test-tidy`.
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
@ -91,24 +88,14 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip
- name: Bootstrap dependencies
run: |
sudo apt update
python3 ./mach bootstrap
- name: Tidy
run: python3 ./mach test-tidy --no-progress --all
python3 ./mach bootstrap --skip-lints
- name: Build (${{ inputs.profile }})
run: |
python3 ./mach build --use-crown --locked --${{ inputs.profile }}

View file

@ -79,20 +79,12 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Bootstrap
run: |
python3 -m pip install --upgrade pip
python3 ./mach bootstrap
python3 ./mach bootstrap --skip-lints
brew install gnu-tar
- name: Build (${{ inputs.profile }})
run: |

View file

@ -38,6 +38,11 @@ jobs:
wpt-layout: ${{ github.event_name == 'pull_request' && 'none' || '2020' }}
secrets: inherit
lint:
name: Lint
uses: ./.github/workflows/lint.yml
secrets: inherit
build-android:
name: Android
if: ${{ github.event_name != 'pull_request' }}
@ -64,6 +69,7 @@ jobs:
- "build-linux"
- "build-android"
- "build-ohos"
- "lint"
steps:
- name: Merge build timings
uses: actions/upload-artifact/merge@v4

View file

@ -44,20 +44,12 @@ jobs:
fetch-depth: 2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Bootstrap Python
run: python3 -m pip install --upgrade pip virtualenv
- name: Bootstrap dependencies
run: sudo apt update && python3 ./mach bootstrap
run: sudo apt update && python3 ./mach bootstrap --skip-lints
- name: Setup OpenHarmony SDK
id: setup_sdk
uses: openharmony-rs/setup-ohos-sdk@v0.1

View file

@ -1,16 +0,0 @@
# This action is meant as a quick check to be run when pushing to
# branches on forks. This allows forks to test the build and unit
# tests automatically without opening a pull request.
name: Quick check
on:
push:
branches-ignore:
["main", "auto", "try", "try-*", "dependabot/**"]
jobs:
build-linux:
name: Linux
if: github.repository != 'servo/servo' || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/linux.yml
with:
unit-tests: true

View file

@ -113,6 +113,7 @@ jobs:
needs: [ "decision", "build" ]
steps:
- name: Merge build timings
continue-on-error: true
uses: actions/upload-artifact/merge@v4
with:
name: cargo-timings

View file

@ -64,16 +64,8 @@ jobs:
run: choco upgrade llvm
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
- name: Install taplo
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
locked: true
- name: Install cargo-deny
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-deny
locked: true
- name: Install crown
run: cargo install --path support/crown
- name: Install wixtoolset
run: |
choco install wixtoolset
@ -86,7 +78,6 @@ jobs:
python -m pip install --upgrade pip
python mach fetch
python mach bootstrap-gstreamer
cargo install --path support/crown
# For some reason WiX isn't currently on the GitHub runner path. This is a
# temporary workaround until that is fixed.
- name: Add WiX to Path

View file

@ -47,6 +47,7 @@ class Workflow(str, Enum):
WINDOWS = "windows"
ANDROID = "android"
OHOS = "ohos"
LINT = "lint"
@dataclass
@ -104,6 +105,8 @@ def handle_preset(s: str) -> Optional[JobConfig]:
wpt_args="--processes 1 _webgpu", # run only webgpu cts
profile="production", # WebGPU works to slow with debug assert
unit_tests=False) # production profile does not work with unit-tests
elif s in ["lint", "tidy"]:
return JobConfig("Lint", Workflow.LINT)
else:
return None
@ -138,7 +141,7 @@ class Config(object):
self.fail_fast = True
continue # skip over keyword
if word == "full":
words.extend(["linux-wpt", "macos", "windows", "android", "ohos"])
words.extend(["linux-wpt", "macos", "windows", "android", "ohos", "lint"])
continue # skip over keyword
job = handle_preset(word)
@ -222,7 +225,14 @@ class TestParser(unittest.TestCase):
"profile": "release",
"unit_tests": False,
"wpt_args": ""
}
},
{
"name": "Lint",
"workflow": "lint",
"wpt_layout": "none",
"profile": "release",
"unit_tests": False,
"wpt_args": ""}
]})
def test_job_merging(self):
@ -259,7 +269,7 @@ class TestParser(unittest.TestCase):
self.assertEqual(a, JobConfig("Linux", Workflow.LINUX, unit_tests=True))
def test_full(self):
self.assertDictEqual(json.loads(Config("linux-wpt macos windows android ohos").to_json()),
self.assertDictEqual(json.loads(Config("linux-wpt macos windows android ohos lint").to_json()),
json.loads(Config("").to_json()))

View file

@ -3,6 +3,7 @@
channel = "1.80.1"
components = [
"clippy",
# For support/crown
"llvm-tools",
# For support/crown