Merge pull request #199 from bcgov/dev #37
This file contains hidden or 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: Test Env - Test + Build Pipeline | |
on: | |
push: | |
branches: | |
- "qa" | |
workflow_dispatch: | |
jobs: | |
codeql-scan: | |
name: codeql-scan | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: [ 'javascript' ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Initializes the CodeQL tools for scanning. | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: ${{ matrix.language }} | |
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | |
- name: Autobuild | |
uses: github/codeql-action/autobuild@v2 | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
zap-owasp: | |
uses: bcgov/pipeline-templates/.github/workflows/owasp-scan.yaml@main | |
with: | |
ZAP_SCAN_TYPE: 'base' # Accepted values are base and full. | |
ZAP_TARGET_URL: https://bc-emli-pin-mgmt-be-c82b4c-test.apps.silver.devops.gov.bc.ca/ | |
ZAP_DURATION: '2' | |
ZAP_MAX_DURATION: '5' | |
ZAP_GCP_PUBLISH: false | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- name: Install dependencies | |
run: npm install | |
# - name: Run linter | |
# run: npm run lint | |
- name: Run tests | |
run: npm test | |
- name: Build | |
run: npm run build | |
####### Need to set up test namespace on openshift | |
- name: Login to Openshift | |
shell: bash | |
run: | | |
oc login --server=${{ secrets.OPENSHIFT_LOGIN_REGISTRY }} --token=${{ secrets.OPENSHIFT_SA_TOKEN_TEST }} | |
- name: Switch to correct project environment in Openshift | |
shell: bash | |
run: | | |
oc project ${{ secrets.OPENSHIFT_NAMESPACE_TEST }} | |
- name: Build image on OpenShift | |
shell: bash | |
run: | | |
oc start-build ${{ secrets.OPENSHIFT_BUILDCONFIG }} |