From 015d172d9dbe3831a31be088155c53be2805cb86 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Mon, 29 Aug 2022 19:27:11 +0200 Subject: [PATCH] ci(testing): separate lint from test (#6951) * ci(testing): separate lint from test * refactor(scripts): extract lint.sh --- .github/workflows/testing.yml | 27 ++++++++++++++++++++++++++- scripts/lint.sh | 23 +++++++++++++++++++++++ scripts/testing.sh | 14 +------------- 3 files changed, 50 insertions(+), 14 deletions(-) create mode 100755 scripts/lint.sh diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index cdd22b3e9efa..1c8cd6c3a283 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -10,7 +10,7 @@ on: pull_request: jobs: - build: + lint: runs-on: ubuntu-latest steps: @@ -41,6 +41,31 @@ jobs: - name: Lint ESLint run: yarn eslint + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: "16" + cache: "yarn" + + - name: Cache node_modules + uses: actions/cache@v3 + id: cached-node_modules + with: + path: | + node_modules + key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('.github/workflows/testing.yml') }} + + - name: Install all yarn packages + if: steps.cached-node_modules.outputs.cache-hit != 'true' + run: | + yarn --frozen-lockfile + - name: Unit testing client run: yarn test:client diff --git a/scripts/lint.sh b/scripts/lint.sh new file mode 100755 index 000000000000..84a46def8cc8 --- /dev/null +++ b/scripts/lint.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env sh + +# Script equivalent of .github/workflows/testing.yml -> lint + +set -e + +echo "-------------------------" +echo "Install all yarn packages" +echo "-------------------------" + +yarn --frozen-lockfile + +echo "-------------" +echo "Lint prettier" +echo "-------------" + +yarn prettier-check + +echo "-----------" +echo "Lint ESLint" +echo "-----------" + +yarn eslint diff --git a/scripts/testing.sh b/scripts/testing.sh index f6f94c526472..117a8faf5f3c 100755 --- a/scripts/testing.sh +++ b/scripts/testing.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -# Script equivalent of .github/workflows/testing.yml +# Script equivalent of .github/workflows/testing.yml -> test set -e @@ -10,18 +10,6 @@ echo "-------------------------" yarn --frozen-lockfile -echo "-------------" -echo "Lint prettier" -echo "-------------" - -yarn prettier-check - -echo "-----------" -echo "Lint ESLint" -echo "-----------" - -yarn eslint - echo "-------------------" echo "Unit testing client" echo "-------------------"