From 18435e417280f4b5408bb19101eb7d6e38356675 Mon Sep 17 00:00:00 2001 From: "Ross Buggins (NHS)" Date: Fri, 14 Jun 2024 14:31:18 +0100 Subject: [PATCH] Added support for node and npm in Jekyll build pipeline. Added SonarCloud (#33) --- .github/workflows/jekyll-gh-pages.yml | 31 ++++++++++++++++++++++++++- sonar-project.properties | 13 +++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index b3005c2..eaa7343 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -36,6 +36,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - run: npm ci - name: Setup Ruby uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 with: @@ -57,8 +61,33 @@ jobs: uses: actions/upload-pages-artifact@v3 with: path: "docs/_site/" + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: site + path: "docs/_site/" + + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download site artifacts + uses: actions/download-artifact@v4 + with: + name: site + path: _site + - name: Display structure of downloaded files + run: ls -R + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # Deployment job + # Deployment job deploy: environment: name: github-pages diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..75e90dc --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,13 @@ +sonar.projectKey=NHSDigital_nhs-notify-web-cms +sonar.organization=nhsdigital + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=nhs-notify +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8