Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20291 move app to app directory #769

Merged
merged 19 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
paths:
- 'app/**'
workflow_dispatch:
inputs:
environment:
Expand All @@ -26,6 +28,7 @@ jobs:
with:
environment: ${{ inputs.environment }}
tagname: ${{ inputs.tagname }}
working_directory: 'app'
secrets:
APP_NAME: "namerequest"
OP_CONNECT_URL: ${{ secrets.OP_CONNECT_URL }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
uses: bcgov/bcregistry-sre/.github/workflows/frontend-ci.yaml@main
with:
app_name: "namerequest"
working_directory: "./"
working_directory: "./app"
codecov_flag: ""
66 changes: 66 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: main-e2e-tests

on:
workflow_dispatch:
inputs:
smoketest:
required: true
description: 'Is this a smoke test?'
default: 'true'
url_parameter:
required: false
description: 'Which URL to test?'
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
env:
CYPRESS_users: ${{ secrets.CYPRESS_USERS }}
CYPRESS_BASE_URL: ${{ inputs.url_parameter || secrets.CYPRESS_BASEURL }}
CYPRESS_ENVIRONMENT: ${{ github.base_ref }}
CYPRESS_loginproxy: ${{ secrets.CYPRESS_LOGINPROXY }}
CYPRESS_siteminder: ${{ secrets.CYPRESS_SITEMINDER }}
CYPRESS_smoketest: ${{inputs.smoketest}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
smoke-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false # https://github.com/cypress-io/github-action/issues/48
steps:
# Checkout the PR branch
- name: Checkout Target Branch
uses: actions/checkout@v4
- name: E2E Smoke tests
uses: cypress-io/github-action@v6
id: smoke
continue-on-error: false
with:
summary-title: 'E2E Smoke tests'
wait-on: ${{ secrets.CYPRESS_HOST }}
wait-on-timeout: 120
record: false
install-command: npm ci
working-directory: testing
spec: |
cypress/e2e/smoke/smoke-*-*.cy.ts
cypress/e2e/name-*-*.cy.ts
browser: chrome
# project: ./e2e
ci-build-id: ${{ github.event.number }}

- name: Run the reports
run: |
cd testing
npm run report

- name: Upload Test Reports
uses: actions/upload-artifact@v4
with:
name: smoke-test-results
path: testing/mochawesome-report/report.html
16 changes: 15 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,18 @@ public/config/configuration.json
*.env
.firebase
*.firebaserc
*.log
*.log

# Cypress related files
**/cypress.env.json
**/node_modules
**/videos/
**/screenshots/
**/results/**
**/downloads/**
**/mochawesome-report/**
**/client.json
**/token.json
**/local-dev/**
**/*copy.json
testing/cypress.config copy.ts
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
92 changes: 47 additions & 45 deletions devops/cloudbuild-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,64 @@
steps:
# install / setup ci
- name: node:20.5.1
entrypoint: npm
args: ['install']

# setup .env
- name: 'bash'
- name: 'node:20.5.1'
env:
- NUXT_ADDRESS_COMPLETE_KEY=$_NUXT_ADDRESS_COMPLETE_KEY
- AUTH_API_KEY=$_AUTH_API_KEY
- AUTH_DOMAIN=$_AUTH_DOMAIN
- AUTH_PROJECT_ID=$_AUTH_PROJECT_ID
- AUTH_MESSAGING_SENDER_ID=$_AUTH_MESSAGING_SENDER_ID
- AUTH_APP_ID=$_AUTH_APP_ID
- NUXT_KEYCLOAK_AUTH_URL=$_NUXT_KEYCLOAK_AUTH_URL
- NUXT_KEYCLOAK_REALM=$_NUXT_KEYCLOAK_REALM
- NUXT_KEYCLOAK_CLIENTID=$_NUXT_KEYCLOAK_CLIENTID
dir: app
script: |
#!/usr/bin/env bash
cp .env.example .env

#
# Generate the static site
#
- name: node:20.5.1
entrypoint: npm
env:
- 'VUE_APP_NAMEREQUEST_LD_CLIENT_ID=$_VUE_APP_NAMEREQUEST_LD_CLIENT_ID'
- 'VUE_APP_GENESYS_ENV=$_VUE_APP_GENESYS_ENV'
- 'VUE_APP_GENESYS_URL=$_VUE_APP_GENESYS_URL'
- 'VUE_APP_GENESYS_ID=$_VUE_APP_GENESYS_ID'
- 'VUE_APP_REGISTRIES_SEARCH_API_KEY=$_VUE_APP_REGISTRIES_SEARCH_API_KEY'
- 'VUE_APP_WEBCHAT_URL=$_VUE_APP_WEBCHAT_URL'
- 'VUE_APP_WEBCHAT_REASON=$_VUE_APP_WEBCHAT_REASON'
- 'VUE_APP_WEBCHAT_STATUS_URL=$_VUE_APP_WEBCHAT_STATUS_URL'
args: ['--openssl-legacy-provider', 'run', 'build']

#
# Deploy to firebase channel, using the PR #
# store log to /workspace to get the channel URL
#
npm install --global pnpm
pnpm install
pnpm build
- name: gcr.io/yfthig-dev/firebase
args:
- '-c'
- >-
firebase hosting:channel:deploy --project=yfthig-dev PR-$_PR_NUMBER >
/workspace/firebase-deploy.txt
dir: app
entrypoint: bash
args: ['-c', 'firebase hosting:channel:deploy --project=yfthig-dev PR-$_PR_NUMBER > /workspace/firebase-deploy.txt']

#
# Update the PR with the temporary URL
#
- id: "Update the PR"
name: gcr.io/cloud-builders/curl
entrypoint: bash
- name: gcr.io/cloud-builders/curl
args:
- -c
- |
- '-c'
- >
# Read from "/workspace"

cat /workspace/firebase-deploy.txt
url=`cat /workspace/firebase-deploy.txt| grep 'Channel URL' | grep -Eo "https://[a-zA-Z0-9./?=_%:-]*"`

url=`cat /workspace/firebase-deploy.txt| grep 'Channel URL' | grep -Eo
"https://[a-zA-Z0-9./?=_%:-]*"`

echo "this is the body:"

echo '{"body": "Temporary Url for review:'"$url"'"}'

curl -X POST \
https://api.github.com/repos/bcgov/namerequest/issues/$_PR_NUMBER/comments \

https://api.github.com/repos/bcgov/namerequest/issues/$_PR_NUMBER/comments
\

--header "Authorization: Token $$TOKEN" \

--header "Accept: application/vnd.github.v3+json" \

--data-binary '{"body": "Temporary Url for review: '"$url"'"}'
secretEnv: ['TOKEN']
dir: app
id: Update the PR
entrypoint: bash
secretEnv:
- TOKEN
options:
dynamicSubstitutions: true
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/token-pr-review/versions/latest
env: 'TOKEN'
options:
dynamic_substitutions: true
- versionName: projects/$PROJECT_ID/secrets/token-pr-review/versions/latest
env: TOKEN

52 changes: 52 additions & 0 deletions testing/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { defineConfig } from 'cypress'
import fs from 'fs'

export default defineConfig({
chromeWebSecurity: false,
defaultCommandTimeout: 40000,
includeShadowDom: true,
responseTimeout: 40000,
redirectionLimit: 100,
experimentalStudio: true,
experimentalMemoryManagement: true,
numTestsKeptInMemory: 0,
viewportHeight: 1080,
viewportWidth: 1920,
video: true,
reporter: 'mochawesome',
reporterOptions: {
files: ['./mochawesome-report/*.json'],
overwrite: false,
html: true,
json: true,
},
e2e: {
// baseUrl: 'https://dev.namex.bcregistry.gov.bc.ca',
// baseUrl: 'https://test.namex.bcregistry.gov.bc.ca',
baseUrl: 'https://test.names.bcregistry.gov.bc.ca',
projectId: '',
setupNodeEvents(on, config) {
on('task', {
checkFileExists(filePath) {
// Check if the file exists
if (fs.existsSync(filePath)) {
return true
} else {
return false
}
},
})
on('before:browser:launch', (browser, launchOptions) => {
if (
browser.family === 'chromium' &&
(browser.name === 'chrome' || browser.name === 'chromium')
) {
// If the browser is Chrome or Chromium, add the flags to expose the `gc` function and disable GPU
launchOptions.args.push('--js-flags=--expose-gc')
launchOptions.args.push('--disable-gpu')
}
return launchOptions
})
},
},
})
Loading
Loading