Skip to content

test18

test18 #30

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches:
- "feature/*"
- "main"
pull_request:
branches:
- "develop"
- "main"
jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://registry.npmjs.org"
- name: Install NPM
run: npm install
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run Tests
run: npm test
static_code_analysis:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Snyk CLI
run: npm install -g snyk
- name: Authenticate with Snyk
run: snyk auth ${{ secrets.SNYK_TOKEN }}
- name: Run Snyk Scan
run: snyk test --all-projects --severity-threshold=high
deploy_to_test:
needs: [static_code_analysis, build_and_test]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/develop'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app
path: |
dist/
src/
test/
mocharc.json
package-lock.json
package.json
tsconfig.json
.gitignore
- name: "Deploy to Azure Web App - Testing"
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: "turners-car-insurance-test-env"
slot-name: "testing"
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_YOUR_SECRET }}
package: .
deploy_to_production:
needs: [static_code_analysis, build_and_test]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.base_ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app
path: |
dist/
src/
test/
mocharc.json
package-lock.json
package.json
tsconfig.json
.gitignore
- name: "Deploy to Azure Web App - Production"
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: "turners-car-insurance-quote"
slot-name: "Production"
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_B5AF5CA862324AC3980A3FDE92C61F45 }}
package: .
#comment test