From d3e27e87fe226da9f3d020025f9ec50558173e50 Mon Sep 17 00:00:00 2001 From: Elliot DeNolf Date: Mon, 6 May 2024 23:32:45 -0400 Subject: [PATCH] ci: add lint job (#6247) --- .github/workflows/main.yml | 47 +++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a464da77..526c565c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,9 @@ on: pull_request: types: [opened, reopened, synchronize] push: - branches: ['main', 'beta'] + branches: + - main + - beta concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -49,6 +51,49 @@ jobs: echo "needs_build: ${{ steps.filter.outputs.needs_build }}" echo "templates: ${{ steps.filter.outputs.templates }}" + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # https://github.com/actions/virtual-environments/issues/1187 + - name: tune linux network + run: sudo ethtool -K eth0 tx off rx off + + - name: Setup Node@${{ env.NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: ${{ env.PNPM_VERSION }} + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v4 + timeout-minutes: 720 + with: + path: ${{ env.STORE_PATH }} + key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + pnpm-store- + pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + + - run: pnpm install + - name: List changed files + run: git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF}...origin/${GITHUB_HEAD_REF} + - name: Lint staged + run: npx lint-staged --diff="origin/${GITHUB_BASE_REF}...origin/${GITHUB_HEAD_REF}" + build: needs: changes if: ${{ needs.changes.outputs.needs_build == 'true' }}