Skip to content

Commit

Permalink
Migrate analyse_code to GHA (#45247)
Browse files Browse the repository at this point in the history
Summary:
This migrates `analyse_code` to GHA into a single job called `lint`.

## Changelog:

[INTERNAL] - Migrate analyse_code to GHA

Pull Request resolved: #45247

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D59283393

Pulled By: cortinico

fbshipit-source-id: dcdc4828a551062b3706e6450614b8c94e1a7e81
  • Loading branch information
cortinico authored and facebook-github-bot committed Jul 3, 2024
1 parent 8db2995 commit c0977c3
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 56 deletions.
6 changes: 2 additions & 4 deletions .circleci/configurations/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ jobs:
when: always

- run:
name: Sanity checks
command: |
./scripts/circleci/check_license.sh
./scripts/circleci/validate_yarn_lockfile.sh
name: Check license
command: ./scripts/circleci/check_license.sh
when: always

- run:
Expand Down
43 changes: 43 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: lint
description: Runs all the linters in the codebase
inputs:
node-version:
description: "The node.js version to use"
required: false
default: "18"
github-token:
description: "The GitHub token used by pull-bot"
required: true
runs:
using: composite
steps:
- name: Setup node.js
uses: ./.github/actions/setup-node
with:
node-version: ${{ inputs.node-version }}
- name: Yarn install
shell: bash
run: yarn install --non-interactive --frozen-lockfile
- name: Run linters against modified files (analysis-bot)
shell: bash
run: yarn lint-ci
env:
GITHUB_TOKEN: ${{ inputs.github-token}}
- name: Lint code
shell: bash
run: ./scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ./reports/junit/eslint/results.xml
- name: Lint java
shell: bash
run: ./scripts/circleci/exec_swallow_error.sh yarn lint-java --check
- name: Run flowcheck
shell: bash
run: yarn flow-check
- name: Run typescript check
shell: bash
run: yarn test-typescript
- name: Check license
shell: bash
run: ./scripts/circleci/check_license.sh
- name: Check formatting
shell: bash
run: yarn run format-check
3 changes: 0 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,6 @@ jobs:
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
# By default we only build ARM64 to save time/resources. For release/nightlies/prealpha, we override this value to build all archs.
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
# Repeated here, as the environment key in this executor will overwrite the one in defaults
PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: ${{ secrets.GITHUB_ANALYSISBOT_TOKEN_A }}
PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: ${{ secrets.GITHUB_ANALYSISBOT_TOKEN_B }}
HERMES_WS_DIR: /tmp/hermes
env:
GHA_NPM_TOKEN: ${{ secrets.GHA_NPM_TOKEN }}
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,6 @@ jobs:
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
# By default we only build ARM64 to save time/resources. For release/nightlies/prealpha, we override this value to build all archs.
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
# Repeated here, as the environment key in this executor will overwrite the one in defaults
PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: ${{ secrets.GITHUB_ANALYSISBOT_TOKEN_A }}
PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: ${{ secrets.GITHUB_ANALYSISBOT_TOKEN_B }}
HERMES_WS_DIR: /tmp/hermes
env:
GHA_NPM_TOKEN: ${{ secrets.GHA_NPM_TOKEN }}
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,6 @@ jobs:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
# By default we only build ARM64 to save time/resources. For release/nightlies/prealpha, we override this value to build all archs.
ORG_GRADLE_PROJECT_reactNativeArchitectures: "arm64-v8a"
# Repeated here, as the environment key in this executor will overwrite the one in defaults
PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: ${{ secrets.GITHUB_ANALYSISBOT_TOKEN_A }}
PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: ${{ secrets.GITHUB_ANALYSISBOT_TOKEN_B }}
HERMES_WS_DIR: /tmp/hermes
steps:
- name: Add github.com to SSH known hosts
Expand Down Expand Up @@ -943,3 +940,15 @@ jobs:
uses: ./.github/actions/test-js
with:
node-version: ${{ matrix.node-version }}

lint:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Run all the Linters
uses: ./.github/actions/lint
with:
github-token: ${{ env.GH_TOKEN }}
43 changes: 0 additions & 43 deletions scripts/circleci/validate_yarn_lockfile.sh

This file was deleted.

0 comments on commit c0977c3

Please sign in to comment.