From 34ffac39cb16dfa3884d1d50723a934df82c371a Mon Sep 17 00:00:00 2001 From: Mihajlo Medjedovic Date: Mon, 31 Jul 2023 13:13:00 +0200 Subject: [PATCH] ci: PR will only run lint check --- .gitea/workflows/build.yaml | 21 +--------- .gitea/workflows/development-test.yaml | 55 +++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index d09e532..c92a368 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,5 +1,5 @@ name: Build -run-name: Building and testing DC +run-name: Running Lint Check on: [pull_request] jobs: @@ -18,21 +18,4 @@ jobs: env: NPMRC: ${{ secrets.NPMRC}} - - run: apt-get update - - run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb - - run: apt install -y ./google-chrome*.deb; - - run: export CHROME_BIN=/usr/bin/google-chrome - - run: npm run lint:check - # Install dependencies~ - - run: npm ci - # Audit should fail and stop the CI if critical vulnerability found - - run: npm audit --audit-level=critical - - run: | - cd ./sas - npm audit --audit-level=critical - - run: | - cd ./client - npm audit --audit-level=critical - npm test -- --no-watch --no-progress --browsers=ChromeHeadlessCI - npm run postinstall - npm run build \ No newline at end of file + - run: npm run lint:check \ No newline at end of file diff --git a/.gitea/workflows/development-test.yaml b/.gitea/workflows/development-test.yaml index 772a71e..05dcd58 100644 --- a/.gitea/workflows/development-test.yaml +++ b/.gitea/workflows/development-test.yaml @@ -6,6 +6,53 @@ on: - development jobs: + Build-production-and-ng-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Write .npmrc file + run: | + touch client/.npmrc + echo '${{ secrets.NPMRC}}' > client/.npmrc + + - name: Install Chrome for Angular tests + run: apt-get update + run: wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb + run: apt install -y ./google-chrome*.deb; + run: export CHROME_BIN=/usr/bin/google-chrome + + - name: Write cypress credentials + run: echo "$CYPRESS_CREDS" > ./client/cypress.env.json + shell: bash + env: + CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }} + + - name: Install dependencies + run: npm ci + + - name: Check audit + # Audit should fail and stop the CI if critical vulnerability found + run: | + npm audit --audit-level=critical + cd ./sas + npm audit --audit-level=critical + cd ./client + npm audit --audit-level=critical + + - name: Angular Tests + run: | + npm test -- --no-watch --no-progress --browsers=ChromeHeadlessCI + + - name: Angular Production Build + run: | + npm run postinstall + npm run build + Build-and-test-development: runs-on: ubuntu-latest @@ -34,7 +81,9 @@ jobs: env: CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }} - - run: npm ci + - name: Install dependencies + run: npm ci + # Install pm2 and prepare SASJS server - run: npm i -g pm2 - run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip @@ -117,7 +166,9 @@ jobs: env: CYPRESS_CREDS: ${{ secrets.CYPRESS_CREDS }} - - run: npm ci + - name: Install dependencies + run: npm ci + # Install pm2 and prepare SASJS server - run: npm i -g pm2 - run: curl -L https://github.com/sasjs/server/releases/latest/download/linux.zip > linux.zip