pipeline-electron-lint.yml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. name: Electron Lint
  2. on:
  3. workflow_call:
  4. inputs:
  5. container:
  6. required: true
  7. description: 'Container to run lint in'
  8. type: string
  9. concurrency:
  10. group: electron-lint-${{ github.ref }}
  11. cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
  12. jobs:
  13. lint:
  14. name: Lint
  15. runs-on: electron-arc-linux-amd64-4core
  16. timeout-minutes: 20
  17. container: ${{ fromJSON(inputs.container) }}
  18. steps:
  19. - name: Checkout Electron
  20. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
  21. with:
  22. path: src/electron
  23. fetch-depth: 0
  24. ref: ${{ github.event.pull_request.head.sha }}
  25. - name: Install Dependencies
  26. uses: ./src/electron/.github/actions/install-dependencies
  27. - name: Setup third_party Depot Tools
  28. shell: bash
  29. run: |
  30. # "depot_tools" has to be checkout into "//third_party/depot_tools" so pylint.py can a "pylintrc" file.
  31. git clone --filter=tree:0 https://chromium.googlesource.com/chromium/tools/depot_tools.git src/third_party/depot_tools
  32. echo "$(pwd)/src/third_party/depot_tools" >> $GITHUB_PATH
  33. - name: Download GN Binary
  34. shell: bash
  35. run: |
  36. chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
  37. gn_version="$(curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/DEPS?format=TEXT" | base64 -d | grep gn_version | head -n1 | cut -d\' -f4)"
  38. cipd ensure -ensure-file - -root . <<-CIPD
  39. \$ServiceURL https://chrome-infra-packages.appspot.com/
  40. @Subdir src/buildtools/linux64
  41. gn/gn/linux-amd64 $gn_version
  42. CIPD
  43. buildtools_path="$(pwd)/src/buildtools"
  44. echo "CHROMIUM_BUILDTOOLS_PATH=$buildtools_path" >> $GITHUB_ENV
  45. - name: Download clang-format Binary
  46. shell: bash
  47. run: |
  48. chromium_revision="$(grep -A1 chromium_version src/electron/DEPS | tr -d '\n' | cut -d\' -f4)"
  49. mkdir -p src/buildtools
  50. curl -sL "https://chromium.googlesource.com/chromium/src/+/${chromium_revision}/buildtools/DEPS?format=TEXT" | base64 -d > src/buildtools/DEPS
  51. gclient sync --spec="solutions=[{'name':'src/buildtools','url':None,'deps_file':'DEPS','custom_vars':{'process_deps':True},'managed':False}]"
  52. - name: Run Lint
  53. shell: bash
  54. run: |
  55. # gn.py tries to find a gclient root folder starting from the current dir.
  56. # When it fails and returns "None" path, the whole script fails. Let's "fix" it.
  57. touch .gclient
  58. # Another option would be to checkout "buildtools" inside the Electron checkout,
  59. # but then we would lint its contents (at least gn format), and it doesn't pass it.
  60. cd src/electron
  61. node script/yarn install --frozen-lockfile
  62. node script/yarn lint
  63. - name: Run Script Typechecker
  64. shell: bash
  65. run: |
  66. cd src/electron
  67. node script/yarn tsc -p tsconfig.script.json