feat(CI) Improve CI (#13360)

Only run lang steps (sort and jsonlint) if there is at least one changed lang file
Run eslint only on the changed files (.js, .ts, .tsx)
This commit is contained in:
Robert Pintilii
2023-05-17 09:45:55 +03:00
committed by GitHub
parent 475c2f4606
commit 61e9cacceb
2 changed files with 15 additions and 2 deletions

View File

@@ -12,14 +12,27 @@ jobs:
with:
node-version: 16
cache: 'npm'
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
- name: Get changed lang files
id: lang-files
run: echo "all=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -oE 'lang\/\S+' | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
- name: Get changed files for eslint
id: eslint-files
run: echo "files=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -oE '\S*(\.js|\.ts|\.tsx)(\s|$)' | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
- run: npm install
- name: Check git status
run: git status
- name: Normalize lang files to ensure sorted
if: steps.lang-files.outputs.all
run: npm run lang-sort
- name: Check lang files are formatted correctly
if: steps.lang-files.outputs.all
run: npm run lint:lang
- name: Check if the git repository is clean
run: $(exit $(git status --porcelain --untracked-files=no | head -255 | wc -l)) || (echo "Dirty git tree"; git diff; exit 1)
- run: npm run lint:ci
- run: npm run lint:ci --files=${{ steps.eslint-files.outputs.files }} && npm run tsc:ci
linux-build:
name: Build Frontend (Linux)
runs-on: ubuntu-latest