From 3b1fece44b99b9546c98adabdc84840d81c482d3 Mon Sep 17 00:00:00 2001 From: Markus Tacker Date: Thu, 9 Nov 2023 14:18:54 +0100 Subject: [PATCH] style: add code-style check to regular test Otherwise code-style issues are not detected on code changes, e.g. if dependencies change rules, or in case the author did not run them. --- .github/workflows/code-style.yaml | 54 ------------------------- .github/workflows/pr.yaml | 9 +++++ .github/workflows/test-and-release.yaml | 9 +++++ 3 files changed, 18 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/code-style.yaml diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml deleted file mode 100644 index e699ed49..00000000 --- a/.github/workflows/code-style.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Ensure source code is properly formatted - -on: - push: - branches: [saga] - -permissions: - contents: write - pull-requests: write - -jobs: - style: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - - uses: actions/setup-node@v4 - with: - node-version: "20.x" - - - name: Keep npm cache around to speed up installs - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }} - - - name: Install dependencies - run: npm ci --no-audit --ignore-scripts - - - name: Compile TypeScript - run: npx tsc - - - name: Check source code with eslint - run: npx eslint --fix --ext .js,.ts,.jsx,.tsx ./ - - - name: Format source code with prettier - run: npx prettier --write ./ - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - commit-message: "style: auto-format source code" - committer: "github-actions[bot] " - author: "github-actions[bot] " - branch: format-source - delete-branch: true - title: "Auto-format source" - body: "Ensure source code is properly formatted" - labels: enhancement diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 57c3d5d3..b05a9e9f 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -25,6 +25,15 @@ jobs: - name: Install dependencies run: npm ci --no-audit + - name: Compile TypeScript + run: npx tsc + + - name: Check source code with eslint + run: npx eslint --fix --ext .js,.ts,.jsx,.tsx ./ + + - name: Check if source code is properly formatted + run: npx prettier -c ./ + - name: Run tests run: npm test diff --git a/.github/workflows/test-and-release.yaml b/.github/workflows/test-and-release.yaml index 0877c20c..99285bcf 100644 --- a/.github/workflows/test-and-release.yaml +++ b/.github/workflows/test-and-release.yaml @@ -32,6 +32,15 @@ jobs: - name: Install dependencies run: npm ci --no-audit + - name: Compile TypeScript + run: npx tsc + + - name: Check source code with eslint + run: npx eslint --fix --ext .js,.ts,.jsx,.tsx ./ + + - name: Check if source code is properly formatted + run: npx prettier -c ./ + - name: Run tests run: npm test