chore: Deploy to k8s #153
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Webapp - Pull Request checks | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
paths: | |
- webapp/** | |
push: | |
branches: | |
- main | |
paths: | |
- webapp/** | |
jobs: | |
install-dependencies: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: webapp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Install dependencies | |
run: npm ci | |
test: | |
runs-on: ubuntu-latest | |
needs: [install-dependencies] | |
defaults: | |
run: | |
working-directory: webapp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Install dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm run test:ci | |
- name: Save coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: webapp/coverage/ | |
build-staging: | |
runs-on: ubuntu-latest | |
needs: [install-dependencies] | |
defaults: | |
run: | |
working-directory: webapp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build:staging | |
lint: | |
runs-on: ubuntu-latest | |
needs: [install-dependencies] | |
defaults: | |
run: | |
working-directory: webapp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
cache: "npm" | |
cache-dependency-path: "**/package-lock.json" | |
- name: Install dependencies | |
run: npm ci | |
- name: Run linter | |
run: npm run lint | |
sonarcloud: | |
runs-on: ubuntu-latest | |
needs: [lint, test, build-staging] | |
defaults: | |
run: | |
working-directory: webapp | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
name: Download coverage report | |
with: | |
name: coverage | |
path: webapp/coverage/ | |
- name: Fix coverage | |
run: | | |
sed -i -e ''s/.*webapp/SF:./g'' coverage/lcov.info | |
- uses: sonarsource/sonarcloud-github-action@master | |
name: SonarCloud Scan | |
with: | |
projectBaseDir: webapp | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_WEBAPP }} |