From a9d5e03bf6012f32fce281ceb9b8104ac43fa224 Mon Sep 17 00:00:00 2001 From: Tanveer Hassan Date: Thu, 13 Jun 2024 12:50:12 +0000 Subject: [PATCH] build: update gh actions --- .github/workflows/build-workflow.yml | 16 +++++++++++++--- .github/workflows/sonarqube-workflow.yml | 24 +++++++++++++++++------- .github/workflows/tests-workflow.yml | 14 ++++++++++++-- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-workflow.yml b/.github/workflows/build-workflow.yml index 5fb9e1c..eef82b8 100644 --- a/.github/workflows/build-workflow.yml +++ b/.github/workflows/build-workflow.yml @@ -1,18 +1,28 @@ name: build on: + push: + branches: + - master pull_request: - branches: [master] + types: [opened, synchronize, reopened] jobs: - build_pull_request: + run_build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20.14.0 + - name: Cache node modules + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - name: Run build step run: npm run build diff --git a/.github/workflows/sonarqube-workflow.yml b/.github/workflows/sonarqube-workflow.yml index ea2cb7a..85839eb 100644 --- a/.github/workflows/sonarqube-workflow.yml +++ b/.github/workflows/sonarqube-workflow.yml @@ -1,10 +1,13 @@ name: SonarCloud build -on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened] + +# Uncomment once you set up Sonarqube +# on: +# push: +# branches: +# - master +# pull_request: +# types: [opened, synchronize, reopened] + jobs: sonarcloud: name: SonarCloud @@ -15,7 +18,14 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20.14.0 + - name: Cache node modules + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - name: Run test cov run: npm run test:cov diff --git a/.github/workflows/tests-workflow.yml b/.github/workflows/tests-workflow.yml index 0af184a..8e64ba2 100644 --- a/.github/workflows/tests-workflow.yml +++ b/.github/workflows/tests-workflow.yml @@ -1,8 +1,11 @@ name: tests on: + push: + branches: + - master pull_request: - branches: [master] + types: [opened, synchronize, reopened] jobs: test_pull_request: @@ -25,7 +28,14 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20.14.0 + - name: Cache node modules + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - run: npm ci - name: Run unit tests run: npm test