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

test(coscrad-frontend): add cypress test of create note about photograph #419

Open
wants to merge 48 commits into
base: integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
05c565d
feat(coscrad-frontend): move audio panel to a drawer (#342)
bsellars Apr 25, 2023
d413d16
feat(coscrad-frontend): move audio panel to a drawer (#358)
bsellars Apr 26, 2023
9abaa00
style(coscrad-frontend): add a drawer to the navbar (#359)
jbambrick May 1, 2023
8d84ad1
style(coscrad-frontend): fix display on nav menu icons (#362)
jbambrick May 2, 2023
a8baae6
feat(cli): introduce first CLI command: domain-dump (#360)
aaron-plahn May 2, 2023
6d5dd90
build(cicd): move builds to DigitalOcean cloud (#363)
aaron-plahn May 3, 2023
8cb7f21
style(coscrad-frontend): widescreen element negative margin fix (#364)
yaanahuu2 May 4, 2023
f8207f5
feat(cli): introduce data-restore cli command (#365)
aaron-plahn May 5, 2023
796af52
style(coscrad-frontend): remove coscrad main content container (#367)
yaanahuu2 May 8, 2023
03e86fa
feat(coscrad-frontend): support theme overrides on content config (#361)
bsellars May 9, 2023
0a46e4a
feat(api): support building a name for every aggregate root (#366)
aaron-plahn May 9, 2023
8f70464
feat(api): add support for straight-to-database endpoint for legacy d…
aaron-plahn May 9, 2023
59c4c61
style(coscrad-frontend): remove conflicting styles (#369)
jbambrick May 10, 2023
16c5e47
test(api): discover command payload schemas dynamically (#371)
aaron-plahn May 11, 2023
57ed67d
test(coscrad-frontend): test components that leverage the configurabl…
bsellars May 12, 2023
33cefac
feat(coscrad-frontend): support custom resource index label (#375)
jbambrick May 12, 2023
736207a
fix(coscrad-frontend): use custom label for resource index in nav men…
aaron-plahn May 12, 2023
4abf884
style(coscrad-frontend): layout paddingTop fix (#373)
jbambrick May 15, 2023
1cb38b4
feat(api): introduce CREATE_PLAYLIST (#378)
bsellars May 17, 2023
dc7cbd5
infra(api): introduce database migration infrastructure (#370)
aaron-plahn May 17, 2023
7bc2561
feature(coscrad-frontend): add tooltip to resource icon (#382)
yaanahuu2 May 18, 2023
4fd5fce
feat(coscrad-frontend): present multilingual text in term views (#377)
jbambrick May 15, 2023
b12410b
style(coscrad-frontend): leverage design standard for vocabulary deta…
jbambrick May 18, 2023
4be266c
infra(api): introduce data dumps and migration records (#381)
aaron-plahn May 18, 2023
8d435eb
infra(api): ensure that **data-dump** dumps full db snapshot (#383)
aaron-plahn May 18, 2023
36bbdb6
infra(api): introduce **revert-latest-migration** (#385)
aaron-plahn May 18, 2023
da2aabd
infra(api): validate invariants post-migration (#386)
aaron-plahn May 19, 2023
ffe22fe
fix(api): fix logging issues with migration cli commands (#387)
aaron-plahn May 23, 2023
439bd4d
docs(cli): add dedicated README for the cli (#388)
aaron-plahn May 23, 2023
2291d0b
build(cicd) introduce separate front-end deployment for Haida project…
aaron-plahn May 29, 2023
5c5e31f
test(api): update test data with valid media URLs (#391)
aaron-plahn May 29, 2023
58398c0
feat(api): introduce ADD_AUDIO_ITEM_TO_PLAYLIST (#392)
bsellars May 31, 2023
902df1b
feat(coscrad): introduce dynamic plural resource labels (#395)
jbambrick Jun 6, 2023
ea5f4fe
test(api): update term test data with valid urls (#396)
aaron-plahn Jun 6, 2023
d59bab1
feat(data-types): support dynamic union types and their validation (#…
aaron-plahn Jun 8, 2023
65b4e21
feat(api): introduce TRANSLATE_PLAYLIST_NAME (#397)
bsellars Jun 12, 2023
3098a2f
feat(api): introduce CREATE_NOTE_ABOUT_RESOURCE (#398)
aaron-plahn Jun 13, 2023
fa7d96d
feat(data-types): introduce dynamic union factory utility (#401)
aaron-plahn Jun 13, 2023
c2787bc
feat(api): introduce CONNECT_RESOURCES_WITH_NOTE (#402)
aaron-plahn Jun 15, 2023
5bc8dcf
WIP: audio clip player with cypress test (#399)
jbambrick Jun 19, 2023
b811484
feat(coscrad): support multilingual text for notes (#404)
aaron-plahn Jun 19, 2023
c81047c
feat(coscrad-frontend): support note creation on the front-end (#407)
aaron-plahn Jun 25, 2023
6ea323b
feat(coscrad-frontend): add menu and login button tooltips (#409)
yaanahuu2 Jun 26, 2023
130463d
test(api): add kktest user to test data (#408)
yaanahuu2 Jun 27, 2023
69deac2
feat(coscrad-frontend): support connection creation on the front-end …
aaron-plahn Jun 28, 2023
bc6da41
feat(coscrad): support tagging on the front-end (#411)
aaron-plahn Jun 28, 2023
d85c654
feat(api): remove multilingual text from command payloads (#412)
aaron-plahn Jun 28, 2023
1c5ef0d
create cypress test for note creation on photograph
yaanahuu Jul 2, 2023
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
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .env

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Thumbs.db

# environment files
*.env
cypress.env.json

# data for data processing scripts
/scripts/data-processing/data
Expand All @@ -50,3 +51,6 @@ auth_config.json
**content.config.ts
# TODO Be careful not to git-ignore third-party configs
**config.json

# COSCRAD CLI command e2e test dummy files
__cli-command-test-files__
246 changes: 203 additions & 43 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* groovylint-disable NestedBlockDepth */
def nodeInstallationName = 'NodeJS 18.12.0'

/* groovylint-disable DuplicateStringLiteral */
/* groovylint-disable-next-line CompileStatic */
pipeline {
Expand All @@ -9,11 +12,9 @@ pipeline {
stages {
stage('ci') {
agent {
docker {
image 'node:18-alpine'
args '-u root'
}
label 'jenkins-build-agent'
}
tools { nodejs nodeInstallationName }
environment {
NODE_ENV = 'test'
NODE_PORT = 3131
Expand All @@ -26,7 +27,6 @@ pipeline {
ARANGO_DB_NAME = 'staging'
AUTH0_ISSUER_URL = 'https://foo.auth0.com/'
AUTH0_AUDIENCE = 'https://bar.mydomain.ca'
BASE_DIGITAL_ASSET_URL = 'https://www.myaudio.com:5555/media?id='
GLOBAL_PREFIX = 'api'
SHOULD_ENABLE_LEGACY_GAMES_ENDPOINT = 'false'
}
Expand All @@ -38,6 +38,10 @@ pipeline {
targetLocation: 'apps/coscrad-frontend/src/auth_config.json')]) {
echo 'PR opened or updated...'
echo "NODE ENV: ${NODE_ENV}"
echo 'node version:'
sh 'node -v'
echo 'npm version'
sh 'npm -v'
echo 'Installing dependencies'
sh 'npm ci --legacy-peer-deps'

Expand Down Expand Up @@ -76,13 +80,11 @@ pipeline {
}
}
}
stage('deploy to staging') {
stage('build and deploy to staging') {
agent {
docker {
image 'node:18-alpine'
args '-u root'
}
label 'jenkins-build-agent'
}
tools { nodejs nodeInstallationName }
environment {
NODE_ENV = 'staging'
NODE_PORT = 3131
Expand All @@ -95,48 +97,206 @@ pipeline {
ARANGO_DB_NAME = 'staging'
AUTH0_ISSUER_URL = 'https://foo.auth0.com/'
AUTH0_AUDIENCE = 'https://bar.mydomain.ca'
BASE_DIGITAL_ASSET_URL = 'https://www.myaudio.com:5555/media?id='
GLOBAL_PREFIX = 'api'
SHOULD_ENABLE_LEGACY_GAMES_ENDPOINT = 'false'
}
when {
branch 'integration'
}
steps {
configFileProvider([configFile(fileId:'42feff14-78da-45fc-a8ee-5f98213a313f', \
targetLocation: 'apps/coscrad-frontend/src/auth_config.json')]) {
echo 'Merged to integration'
echo "NODE ENV: ${NODE_ENV}"
echo 'Installing dependencies'
sh 'npm ci --legacy-peer-deps'
stages {
stage('install dependencies') {
steps {
echo 'Running staging build'
echo "NODE ENV: ${NODE_ENV}"
echo 'Installing dependencies'
sh 'npm ci --legacy-peer-deps'
}
}
stage('build front-end for COSCRAD sandbox') {
steps {
runFrontendBuild('COSCRAD')
}
post {
success {
deployFrontend('COSCRAD')
}
}
}
stage('build front-end for Haida sandbox') {
steps {
runFrontendBuild('Haida')
}
post {
success {
deployFrontend('Haida')
}
}
}
stage('build back-end') {
steps {
sh 'npx nx run build api --prod'
}
post {
success {
deployBackend()
}
}
}
stage('build cli') {
steps {
sh 'npx nx run api:build:cli'
}
post {
success {
deployCli()
}
}
}
}
}
}
}

echo 'Building COSCRAD'
echo 'with node version'
sh 'node --version'
/**
* TODO We might be able to have a single function that switches on `target` and
* sets several global variables to be used in various steps.
*/
String getContentConfigFilename(String target) {
if (target == 'COSCRAD') { return 'content.config.SAMPLE.ts' }

/**
* Note that the sample content config is actually valid for
* our staging build.
**/
echo 'copying sample content config for test build'
/* groovylint-disable-next-line LineLength */
sh 'cp apps/coscrad-frontend/src/configurable-front-matter/data/content.config.SAMPLE.ts apps/coscrad-frontend/src/configurable-front-matter/data/content.config.ts'
if (target == 'Haida') { return 'content.config.STAGING.ts' }

sh 'npm run build:coscrad:prod'
}
}
post {
success {
archiveArtifacts artifacts: 'dist/**, node_modules/**', followSymlinks: false
// Deploy front-end build to staging
sshPublisher(
publishers: [sshPublisherDesc(configName: '[email protected]', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'rm -rf /var/www/html && mv build/dist/apps/coscrad-frontend /var/www/html && rm -rf build', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: 'build', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'dist/**')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])

// Deploy back-end build to staging
sshPublisher(
publishers: [sshPublisherDesc(configName: '[email protected]', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'rm -rf archive ; mv build archive; touch archive/dist/apps/api/staging.env; PATH=$PATH://home/coscradmin/.nvm/versions/node/v18.16.0/bin pm2 restart main; echo API restarted', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: 'build', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'dist/**, node_modules/**')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
error "unsupported deployment target: ${target}"

// This is to satisfy the linter. Maybe we should be explicitly throwing in the line above?
return ''
}

/**
* # Available Targets
- COSCRAD
- Haida
**/
void copyContentConfig(String target) {
String contentConfigDirectory = 'apps/coscrad-frontend/src/configurable-front-matter/data/'

/**
* Note that the sample content config is actually valid for
* our staging build.
**/
echo "attempting to copy sample content config for test build for target ${target}"

/* groovylint-disable-next-line LineLength */
sh "cp ${contentConfigDirectory}${getContentConfigFilename(target)} ${contentConfigDirectory}content.config.ts"

return
}

void runFrontendBuild(String target) {
configFileProvider([configFile(fileId:'staging.auth.config', \
targetLocation: 'apps/coscrad-frontend/src/auth_config.json')]) {
echo "Building COSCRAD front-end for target project: ${target}"
echo 'with node version'
sh 'node --version'

copyContentConfig(target)
sh 'npx nx build coscrad-frontend --prod --skip-nx-cache'

echo 'build contents'
sh 'ls dist/apps'
}
}
}
}

String getDeploymentDirectoryForFrontendBuild(String target) {
if (target == 'COSCRAD') {
return 'html'
}

if (target == 'Haida') {
return 'haida'
}

error "No deployment directory found for unknown build target: ${target}"

return ''
}

void publishArtifacts(String sshConfigName, \
String postTransferCommand, \
String remoteDirectory, \
String sourceFilePattern) {
sshPublisher(
publishers: [
sshPublisherDesc(
configName: sshConfigName,
transfers: [
sshTransfer(
cleanRemote: false,
excludes: '',
execCommand: postTransferCommand,
execTimeout: 120000,
flatten: false, makeEmptyDirs:
false, noDefaultExcludes: false,
patternSeparator: '[, ]+',
remoteDirectory: remoteDirectory,
remoteDirectorySDF: false,
removePrefix: '',
sourceFiles: sourceFilePattern
)],
usePromotionTimestamp: false,
useWorkspaceInPromotion: false,
verbose: false
)])
}

void archiveArtifacts(String sourceFilePattern) {
archiveArtifacts artifacts: sourceFilePattern, followSymlinks: false
}

void deployFrontend(String target) {
String basePath = '/var/www/'

String deploymentDirectory = getDeploymentDirectoryForFrontendBuild(target)

String fullDeploymentPath = "${basePath}${deploymentDirectory}"

String command = "rm -rf ${fullDeploymentPath} \
&& mv build/dist/apps/coscrad-frontend \
${fullDeploymentPath} && rm -rf build "

String sourceFilePattern = 'dist/apps/coscrad-frontend/**'

archiveArtifacts(sourceFilePattern)

publishArtifacts('[email protected]', command, 'build', sourceFilePattern)
}

void deployBackend() {
String backendArtifactsPattern = 'dist/apps/api/**, node_modules/**'

String postDeployCommand = 'rm -rf archive ; \
mv build archive; \
touch archive/dist/apps/api/staging.env; \
PATH=$PATH://home/coscradmin/.nvm/versions/node/v18.16.0/bin pm2 restart main; \
echo API restarted'

archiveArtifacts(backendArtifactsPattern)

publishArtifacts('[email protected]',
postDeployCommand, \
'build', \
backendArtifactsPattern)
}

void deployCli() {
String backendArtifactsPattern = 'dist/apps/coscrad-cli/**'

String postDeployCommand = 'echo CLI build copied'

archiveArtifacts(backendArtifactsPattern)

publishArtifacts('[email protected]',
postDeployCommand, \
'cli', \
backendArtifactsPattern)
}
18 changes: 1 addition & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,7 @@ that leverage the COSCRAD API. The Many ideas explored in the community projects
will eventually find their way into Coscrad's core.

**COSCRAD CLI**
We also have built our own command-line interface, `COSCRAD CLI`. This is used
for administrative tasks like dumping data snapshots (in persistence layer, domain layer
and view layer formats), seeding test data and restoring data dumps, dumping
a JSON version of schemas for our domain models, view models, command and event payloads,
and so on.

Currently, `COSCRAD CLI` is part of the `api`, and it is available via a custom
build of the `api`. Run `npx nx build:api:cli` to build the `COSCRAD CLI`. The
cli will be built to `dist/apps/cosccrad-cli`. Run

```
node main.js <command> <options>
```

from within this directory to execute a `COSCRAD CLI` command.

<!-- TODO Add documentation for all commands -->
The `coscrad-cli` is a command line tool for data administration tasks. Its use is documented [here](./apps/api/cli.README.md)

In the future, once our domain has been moved to a separate lib, we will move
the `COSCRAD CLI` to a standalone app in the mono-repo.
Expand Down
Loading