mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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:
parent
0afcb83e9f
commit
ebdae6094e
12 changed files with 100 additions and 79 deletions
14
.github/workflows/android.yml
vendored
14
.github/workflows/android.yml
vendored
|
@ -50,20 +50,12 @@ jobs:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- name: Run sccache-cache
|
- name: Run sccache-cache
|
||||||
uses: mozilla-actions/sccache-action@v0.0.4
|
uses: mozilla-actions/sccache-action@v0.0.4
|
||||||
- name: Install taplo
|
- name: Install crown
|
||||||
uses: baptiste0928/cargo-install@v3
|
run: cargo install --path support/crown
|
||||||
with:
|
|
||||||
crate: taplo-cli
|
|
||||||
locked: true
|
|
||||||
- name: Install cargo-deny
|
|
||||||
uses: baptiste0928/cargo-install@v3
|
|
||||||
with:
|
|
||||||
crate: cargo-deny
|
|
||||||
locked: true
|
|
||||||
- name: Bootstrap Python
|
- name: Bootstrap Python
|
||||||
run: python3 -m pip install --upgrade pip virtualenv
|
run: python3 -m pip install --upgrade pip virtualenv
|
||||||
- name: Bootstrap dependencies
|
- name: Bootstrap dependencies
|
||||||
run: sudo apt update && python3 ./mach bootstrap
|
run: sudo apt update && python3 ./mach bootstrap --skip-lints
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
|
|
6
.github/workflows/dispatch-workflow.yml
vendored
6
.github/workflows/dispatch-workflow.yml
vendored
|
@ -50,6 +50,12 @@ jobs:
|
||||||
unit-tests: ${{ inputs.unit-tests }}
|
unit-tests: ${{ inputs.unit-tests }}
|
||||||
wpt-args: ${{ inputs.wpt-args }}
|
wpt-args: ${{ inputs.wpt-args }}
|
||||||
|
|
||||||
|
lint:
|
||||||
|
if: ${{ inputs.workflow == 'lint' }}
|
||||||
|
name: Lint
|
||||||
|
uses: ./.github/workflows/lint.yml
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
android:
|
android:
|
||||||
if: ${{ inputs.workflow == 'android' }}
|
if: ${{ inputs.workflow == 'android' }}
|
||||||
name: Android
|
name: Android
|
||||||
|
|
59
.github/workflows/lint.yml
vendored
Normal file
59
.github/workflows/lint.yml
vendored
Normal 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
|
19
.github/workflows/linux.yml
vendored
19
.github/workflows/linux.yml
vendored
|
@ -74,15 +74,12 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
if: github.event_name != 'pull_request_target'
|
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
|
# This is necessary to checkout the pull request if this run was triggered via a
|
||||||
# `pull_request_target` event.
|
# `pull_request_target` event.
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
if: github.event_name == 'pull_request_target'
|
if: github.event_name == 'pull_request_target'
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
fetch-depth: 2 # This is necessary for `test-tidy`.
|
|
||||||
- name: Run sccache-cache
|
- name: Run sccache-cache
|
||||||
uses: mozilla-actions/sccache-action@v0.0.4
|
uses: mozilla-actions/sccache-action@v0.0.4
|
||||||
- name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
|
- name: Set LIBCLANG_PATH env # needed for bindgen in mozangle
|
||||||
|
@ -91,24 +88,14 @@ jobs:
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- name: Install taplo
|
- name: Install crown
|
||||||
uses: baptiste0928/cargo-install@v3
|
run: cargo install --path support/crown
|
||||||
with:
|
|
||||||
crate: taplo-cli
|
|
||||||
locked: true
|
|
||||||
- name: Install cargo-deny
|
|
||||||
uses: baptiste0928/cargo-install@v3
|
|
||||||
with:
|
|
||||||
crate: cargo-deny
|
|
||||||
locked: true
|
|
||||||
- name: Bootstrap Python
|
- name: Bootstrap Python
|
||||||
run: python3 -m pip install --upgrade pip
|
run: python3 -m pip install --upgrade pip
|
||||||
- name: Bootstrap dependencies
|
- name: Bootstrap dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
python3 ./mach bootstrap
|
python3 ./mach bootstrap --skip-lints
|
||||||
- name: Tidy
|
|
||||||
run: python3 ./mach test-tidy --no-progress --all
|
|
||||||
- name: Build (${{ inputs.profile }})
|
- name: Build (${{ inputs.profile }})
|
||||||
run: |
|
run: |
|
||||||
python3 ./mach build --use-crown --locked --${{ inputs.profile }}
|
python3 ./mach build --use-crown --locked --${{ inputs.profile }}
|
||||||
|
|
14
.github/workflows/mac.yml
vendored
14
.github/workflows/mac.yml
vendored
|
@ -79,20 +79,12 @@ jobs:
|
||||||
ref: ${{ github.event.pull_request.head.sha }}
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
- name: Run sccache-cache
|
- name: Run sccache-cache
|
||||||
uses: mozilla-actions/sccache-action@v0.0.4
|
uses: mozilla-actions/sccache-action@v0.0.4
|
||||||
- name: Install taplo
|
- name: Install crown
|
||||||
uses: baptiste0928/cargo-install@v3
|
run: cargo install --path support/crown
|
||||||
with:
|
|
||||||
crate: taplo-cli
|
|
||||||
locked: true
|
|
||||||
- name: Install cargo-deny
|
|
||||||
uses: baptiste0928/cargo-install@v3
|
|
||||||
with:
|
|
||||||
crate: cargo-deny
|
|
||||||
locked: true
|
|
||||||
- name: Bootstrap
|
- name: Bootstrap
|
||||||
run: |
|
run: |
|
||||||
python3 -m pip install --upgrade pip
|
python3 -m pip install --upgrade pip
|
||||||
python3 ./mach bootstrap
|
python3 ./mach bootstrap --skip-lints
|
||||||
brew install gnu-tar
|
brew install gnu-tar
|
||||||
- name: Build (${{ inputs.profile }})
|
- name: Build (${{ inputs.profile }})
|
||||||
run: |
|
run: |
|
||||||
|
|
6
.github/workflows/main.yml
vendored
6
.github/workflows/main.yml
vendored
|
@ -38,6 +38,11 @@ jobs:
|
||||||
wpt-layout: ${{ github.event_name == 'pull_request' && 'none' || '2020' }}
|
wpt-layout: ${{ github.event_name == 'pull_request' && 'none' || '2020' }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
lint:
|
||||||
|
name: Lint
|
||||||
|
uses: ./.github/workflows/lint.yml
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
build-android:
|
build-android:
|
||||||
name: Android
|
name: Android
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
|
@ -64,6 +69,7 @@ jobs:
|
||||||
- "build-linux"
|
- "build-linux"
|
||||||
- "build-android"
|
- "build-android"
|
||||||
- "build-ohos"
|
- "build-ohos"
|
||||||
|
- "lint"
|
||||||
steps:
|
steps:
|
||||||
- name: Merge build timings
|
- name: Merge build timings
|
||||||
uses: actions/upload-artifact/merge@v4
|
uses: actions/upload-artifact/merge@v4
|
||||||
|
|
14
.github/workflows/ohos.yml
vendored
14
.github/workflows/ohos.yml
vendored
|
@ -44,20 +44,12 @@ jobs:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- name: Run sccache-cache
|
- name: Run sccache-cache
|
||||||
uses: mozilla-actions/sccache-action@v0.0.4
|
uses: mozilla-actions/sccache-action@v0.0.4
|
||||||
- name: Install taplo
|
- name: Install crown
|
||||||
uses: baptiste0928/cargo-install@v3
|
run: cargo install --path support/crown
|
||||||
with:
|
|
||||||
crate: taplo-cli
|
|
||||||
locked: true
|
|
||||||
- name: Install cargo-deny
|
|
||||||
uses: baptiste0928/cargo-install@v3
|
|
||||||
with:
|
|
||||||
crate: cargo-deny
|
|
||||||
locked: true
|
|
||||||
- name: Bootstrap Python
|
- name: Bootstrap Python
|
||||||
run: python3 -m pip install --upgrade pip virtualenv
|
run: python3 -m pip install --upgrade pip virtualenv
|
||||||
- name: Bootstrap dependencies
|
- name: Bootstrap dependencies
|
||||||
run: sudo apt update && python3 ./mach bootstrap
|
run: sudo apt update && python3 ./mach bootstrap --skip-lints
|
||||||
- name: Setup OpenHarmony SDK
|
- name: Setup OpenHarmony SDK
|
||||||
id: setup_sdk
|
id: setup_sdk
|
||||||
uses: openharmony-rs/setup-ohos-sdk@v0.1
|
uses: openharmony-rs/setup-ohos-sdk@v0.1
|
||||||
|
|
16
.github/workflows/quick-check.yml
vendored
16
.github/workflows/quick-check.yml
vendored
|
@ -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
|
|
1
.github/workflows/try.yml
vendored
1
.github/workflows/try.yml
vendored
|
@ -113,6 +113,7 @@ jobs:
|
||||||
needs: [ "decision", "build" ]
|
needs: [ "decision", "build" ]
|
||||||
steps:
|
steps:
|
||||||
- name: Merge build timings
|
- name: Merge build timings
|
||||||
|
continue-on-error: true
|
||||||
uses: actions/upload-artifact/merge@v4
|
uses: actions/upload-artifact/merge@v4
|
||||||
with:
|
with:
|
||||||
name: cargo-timings
|
name: cargo-timings
|
||||||
|
|
13
.github/workflows/windows.yml
vendored
13
.github/workflows/windows.yml
vendored
|
@ -64,16 +64,8 @@ jobs:
|
||||||
run: choco upgrade llvm
|
run: choco upgrade llvm
|
||||||
- name: ccache
|
- name: ccache
|
||||||
uses: hendrikmuhs/ccache-action@v1.2
|
uses: hendrikmuhs/ccache-action@v1.2
|
||||||
- name: Install taplo
|
- name: Install crown
|
||||||
uses: baptiste0928/cargo-install@v3
|
run: cargo install --path support/crown
|
||||||
with:
|
|
||||||
crate: taplo-cli
|
|
||||||
locked: true
|
|
||||||
- name: Install cargo-deny
|
|
||||||
uses: baptiste0928/cargo-install@v3
|
|
||||||
with:
|
|
||||||
crate: cargo-deny
|
|
||||||
locked: true
|
|
||||||
- name: Install wixtoolset
|
- name: Install wixtoolset
|
||||||
run: |
|
run: |
|
||||||
choco install wixtoolset
|
choco install wixtoolset
|
||||||
|
@ -86,7 +78,6 @@ jobs:
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python mach fetch
|
python mach fetch
|
||||||
python mach bootstrap-gstreamer
|
python mach bootstrap-gstreamer
|
||||||
cargo install --path support/crown
|
|
||||||
# For some reason WiX isn't currently on the GitHub runner path. This is a
|
# For some reason WiX isn't currently on the GitHub runner path. This is a
|
||||||
# temporary workaround until that is fixed.
|
# temporary workaround until that is fixed.
|
||||||
- name: Add WiX to Path
|
- name: Add WiX to Path
|
||||||
|
|
|
@ -47,6 +47,7 @@ class Workflow(str, Enum):
|
||||||
WINDOWS = "windows"
|
WINDOWS = "windows"
|
||||||
ANDROID = "android"
|
ANDROID = "android"
|
||||||
OHOS = "ohos"
|
OHOS = "ohos"
|
||||||
|
LINT = "lint"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
@ -104,6 +105,8 @@ def handle_preset(s: str) -> Optional[JobConfig]:
|
||||||
wpt_args="--processes 1 _webgpu", # run only webgpu cts
|
wpt_args="--processes 1 _webgpu", # run only webgpu cts
|
||||||
profile="production", # WebGPU works to slow with debug assert
|
profile="production", # WebGPU works to slow with debug assert
|
||||||
unit_tests=False) # production profile does not work with unit-tests
|
unit_tests=False) # production profile does not work with unit-tests
|
||||||
|
elif s in ["lint", "tidy"]:
|
||||||
|
return JobConfig("Lint", Workflow.LINT)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -138,7 +141,7 @@ class Config(object):
|
||||||
self.fail_fast = True
|
self.fail_fast = True
|
||||||
continue # skip over keyword
|
continue # skip over keyword
|
||||||
if word == "full":
|
if word == "full":
|
||||||
words.extend(["linux-wpt", "macos", "windows", "android", "ohos"])
|
words.extend(["linux-wpt", "macos", "windows", "android", "ohos", "lint"])
|
||||||
continue # skip over keyword
|
continue # skip over keyword
|
||||||
|
|
||||||
job = handle_preset(word)
|
job = handle_preset(word)
|
||||||
|
@ -222,7 +225,14 @@ class TestParser(unittest.TestCase):
|
||||||
"profile": "release",
|
"profile": "release",
|
||||||
"unit_tests": False,
|
"unit_tests": False,
|
||||||
"wpt_args": ""
|
"wpt_args": ""
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "Lint",
|
||||||
|
"workflow": "lint",
|
||||||
|
"wpt_layout": "none",
|
||||||
|
"profile": "release",
|
||||||
|
"unit_tests": False,
|
||||||
|
"wpt_args": ""}
|
||||||
]})
|
]})
|
||||||
|
|
||||||
def test_job_merging(self):
|
def test_job_merging(self):
|
||||||
|
@ -259,7 +269,7 @@ class TestParser(unittest.TestCase):
|
||||||
self.assertEqual(a, JobConfig("Linux", Workflow.LINUX, unit_tests=True))
|
self.assertEqual(a, JobConfig("Linux", Workflow.LINUX, unit_tests=True))
|
||||||
|
|
||||||
def test_full(self):
|
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()))
|
json.loads(Config("").to_json()))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
channel = "1.80.1"
|
channel = "1.80.1"
|
||||||
|
|
||||||
components = [
|
components = [
|
||||||
|
"clippy",
|
||||||
# For support/crown
|
# For support/crown
|
||||||
"llvm-tools",
|
"llvm-tools",
|
||||||
# For support/crown
|
# For support/crown
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue