Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/starter.yaml
  • Loading branch information
charlymo committed May 8, 2024
2 parents 2a57e0b + f5cddaf commit 373333a
Show file tree
Hide file tree
Showing 60 changed files with 6,458 additions and 3,606 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cache-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: cleanup caches by a branch
on:
repository_dispatch:
types: [run]
workflow_dispatch: {}

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
144 changes: 141 additions & 3 deletions .github/workflows/starter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
setup_workflow_env:
runs-on: ubuntu-latest
# Optionally specify the environment that should be used on this branch
# environment: production
# environment: review/dev
outputs:
# It seems you have to specify the environment twice (passed to reusable workflow)
# as there is no way yet to get the active environment
# environment: production
# environment: review/dev
# or see the switch on ref_name script below
environment: ${{ steps.get_environment_from_git_ref.outputs.environment }}
environment_short: ${{ steps.get_environment_from_git_ref.outputs.environment_short }}
Expand All @@ -24,7 +24,7 @@ jobs:
# Usually you don't deal with all commits since the repository was created.
# Increase if you e.g don't find a tag you want to display in the application
fetch-depth: 10
submodules: "false"
submodules: "true"
herokuish_base_image: ghcr.io/acdh-oeaw/herokuish-for-cypress/main:latest-22
BUILDPACK_URL: https://github.com/simar0at/heroku-buildpack-basex
APP_NAME: vicav-app
Expand Down Expand Up @@ -67,6 +67,60 @@ jobs:
outputs:
PUBLIC_URL: ${{ steps.generate_public_url.outputs.public_url }}
environment: ${{ needs.setup_workflow_env.outputs.environment }}
generate_workflow_vars-tunocent:
needs: [setup_workflow_env]
environment:
name: ${{ needs.setup_workflow_env.outputs.environment }}-tunocent
runs-on: ubuntu-latest
steps:
- name: Generate PUBLIC_URL if not set
id: generate_public_url
run: |
kube_ingress_base_domain="${{ vars.KUBE_INGRESS_BASE_DOMAIN }}"
public_url="${{ needs.setup_workflow_env.outputs.PUBLIC_URL || vars.PUBLIC_URL }}"
if [ "${public_url}x" == 'x' ]
then public_url=https://tunocent-${{ needs.setup_workflow_env.outputs.environment_short }}.${kube_ingress_base_domain}
fi
echo "public_url=$public_url" >> $GITHUB_OUTPUT
outputs:
PUBLIC_URL: ${{ steps.generate_public_url.outputs.public_url }}
environment: ${{ needs.setup_workflow_env.outputs.environment }}-tunocent
generate_workflow_vars-shawi:
needs: [setup_workflow_env]
environment:
name: ${{ needs.setup_workflow_env.outputs.environment }}-shawi
runs-on: ubuntu-latest
steps:
- name: Generate PUBLIC_URL if not set
id: generate_public_url
run: |
kube_ingress_base_domain="${{ vars.KUBE_INGRESS_BASE_DOMAIN }}"
public_url="${{ needs.setup_workflow_env.outputs.PUBLIC_URL || vars.PUBLIC_URL }}"
if [ "${public_url}x" == 'x' ]
then public_url=https://shawi-${{ needs.setup_workflow_env.outputs.environment_short }}.${kube_ingress_base_domain}
fi
echo "public_url=$public_url" >> $GITHUB_OUTPUT
outputs:
PUBLIC_URL: ${{ steps.generate_public_url.outputs.public_url }}
environment: ${{ needs.setup_workflow_env.outputs.environment }}-shawi
generate_workflow_vars-wibarab:
needs: [setup_workflow_env]
environment:
name: ${{ needs.setup_workflow_env.outputs.environment }}-wibarab
runs-on: ubuntu-latest
steps:
- name: Generate PUBLIC_URL if not set
id: generate_public_url
run: |
kube_ingress_base_domain="${{ vars.KUBE_INGRESS_BASE_DOMAIN }}"
public_url="${{ needs.setup_workflow_env.outputs.PUBLIC_URL || vars.PUBLIC_URL }}"
if [ "${public_url}x" == 'x' ]
then public_url=https://wibarab-${{ needs.setup_workflow_env.outputs.environment_short }}.${kube_ingress_base_domain}
fi
echo "public_url=$public_url" >> $GITHUB_OUTPUT
outputs:
PUBLIC_URL: ${{ steps.generate_public_url.outputs.public_url }}
environment: ${{ needs.setup_workflow_env.outputs.environment }}-wibarab
_1:
needs: [setup_workflow_env, generate_workflow_vars]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/build-herokuish-and-push-to-registry.yaml@main
Expand All @@ -80,6 +134,45 @@ jobs:
default_port: ${{ needs.setup_workflow_env.outputs.default_port }}
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_1-tunocent:
needs: [setup_workflow_env, generate_workflow_vars-tunocent]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/build-herokuish-and-push-to-registry.yaml@main
secrets: inherit
# if you run this outside of acdh-oeaw yo uneed to specify every secret you want to pass by name
with:
environment: ${{ needs.generate_workflow_vars-tunocent.outputs.environment}}
BUILDPACK_URL: ${{ needs.setup_workflow_env.outputs.BUILDPACK_URL }}
registry_root: ${{ needs.setup_workflow_env.outputs.registry_root }}
image_tagged: ${{ needs.setup_workflow_env.outputs.image_tagged }}-tunocent
default_port: ${{ needs.setup_workflow_env.outputs.default_port }}
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_1-shawi:
needs: [setup_workflow_env, generate_workflow_vars-shawi]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/build-herokuish-and-push-to-registry.yaml@main
secrets: inherit
# if you run this outside of acdh-oeaw yo uneed to specify every secret you want to pass by name
with:
environment: ${{ needs.generate_workflow_vars-shawi.outputs.environment}}
BUILDPACK_URL: ${{ needs.setup_workflow_env.outputs.BUILDPACK_URL }}
registry_root: ${{ needs.setup_workflow_env.outputs.registry_root }}
image_tagged: ${{ needs.setup_workflow_env.outputs.image_tagged }}-shawi
default_port: ${{ needs.setup_workflow_env.outputs.default_port }}
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_1-wibarab:
needs: [setup_workflow_env, generate_workflow_vars-wibarab]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/build-herokuish-and-push-to-registry.yaml@main
secrets: inherit
# if you run this outside of acdh-oeaw yo uneed to specify every secret you want to pass by name
with:
environment: ${{ needs.generate_workflow_vars-wibarab.outputs.environment}}
BUILDPACK_URL: ${{ needs.setup_workflow_env.outputs.BUILDPACK_URL }}
registry_root: ${{ needs.setup_workflow_env.outputs.registry_root }}
image_tagged: ${{ needs.setup_workflow_env.outputs.image_tagged }}-wibarab
default_port: ${{ needs.setup_workflow_env.outputs.default_port }}
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_2:
needs: [setup_workflow_env]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/herokuish-tests-db-url.yaml@main
Expand Down Expand Up @@ -110,3 +203,48 @@ jobs:
default_port: "${{ needs.setup_workflow_env.outputs.default_port}}"
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_3-tunocent:
needs: [setup_workflow_env, generate_workflow_vars-tunocent, _1-tunocent, _2]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/deploy.yml@main
secrets: inherit
with:
environment: ${{ needs.generate_workflow_vars-tunocent.outputs.environment}}
DOCKER_TAG: ${{ needs.setup_workflow_env.outputs.registry_root }}${{ needs.setup_workflow_env.outputs.image_tagged }}-tunocent
APP_NAME: tunocent-app-${{ needs.setup_workflow_env.outputs.environment_short }}
APP_ROOT: ${{ needs.setup_workflow_env.outputs.APP_ROOT }}
SERVICE_ID: ${{ needs.setup_workflow_env.outputs.SERVICE_ID }}
PUBLIC_URL: ${{ needs.generate_workflow_vars-tunocent.outputs.PUBLIC_URL }}
POSTGRES_ENABLED: ${{ needs.setup_workflow_env.outputs.POSTGRES_ENABLED == 'true'}}
default_port: "${{ needs.setup_workflow_env.outputs.default_port}}"
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_3-shawi:
needs: [setup_workflow_env, generate_workflow_vars-shawi, _1-shawi, _2]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/deploy-cluster-2.yml@main
secrets: inherit
with:
environment: ${{ needs.generate_workflow_vars-shawi.outputs.environment}}
DOCKER_TAG: ${{ needs.setup_workflow_env.outputs.registry_root }}${{ needs.setup_workflow_env.outputs.image_tagged }}-shawi
APP_NAME: shawi-app-${{ needs.setup_workflow_env.outputs.environment_short }}
APP_ROOT: ${{ needs.setup_workflow_env.outputs.APP_ROOT }}
SERVICE_ID: ${{ needs.setup_workflow_env.outputs.SERVICE_ID }}
PUBLIC_URL: ${{ needs.generate_workflow_vars-shawi.outputs.PUBLIC_URL }}
POSTGRES_ENABLED: ${{ needs.setup_workflow_env.outputs.POSTGRES_ENABLED == 'true'}}
default_port: "${{ needs.setup_workflow_env.outputs.default_port}}"
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
_3-wibarab:
needs: [setup_workflow_env, generate_workflow_vars-wibarab, _1-wibarab, _2]
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/deploy.yml@main
secrets: inherit
with:
environment: ${{ needs.generate_workflow_vars-wibarab.outputs.environment}}
DOCKER_TAG: ${{ needs.setup_workflow_env.outputs.registry_root }}${{ needs.setup_workflow_env.outputs.image_tagged }}-wibarab
APP_NAME: wibarab-app-${{ needs.setup_workflow_env.outputs.environment_short }}
APP_ROOT: ${{ needs.setup_workflow_env.outputs.APP_ROOT }}
SERVICE_ID: ${{ needs.setup_workflow_env.outputs.SERVICE_ID }}
PUBLIC_URL: ${{ needs.generate_workflow_vars-wibarab.outputs.PUBLIC_URL }}
POSTGRES_ENABLED: ${{ needs.setup_workflow_env.outputs.POSTGRES_ENABLED == 'true'}}
default_port: "${{ needs.setup_workflow_env.outputs.default_port}}"
fetch-depth: ${{ fromJson(needs.setup_workflow_env.outputs.fetch-depth)}}
submodules: ${{ needs.setup_workflow_env.outputs.submodules }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
**/.DS_Store
OLDSITE/

# ide
.idea
node_modules/
backup
images/**/*.jpg
images/**/*.png
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "openapi4restxq"]
path = 3rd-party/openapi4restxq
url = https://github.com/acdh-oeaw/openapi4restxq.git
[submodule "vleserver_basex"]
path = 3rd-party/vleserver_basex
url = https://github.com/acdh-oeaw/vleserver_basex.git
1 change: 1 addition & 0 deletions 3rd-party/openapi4restxq
Submodule openapi4restxq added at 8a87a8
1 change: 1 addition & 0 deletions 3rd-party/vleserver_basex
Submodule vleserver_basex added at 867217
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ Set up a local instance
* in `<basexhome>/webapp` git clone [this repository](https://github.com/acdh-oeaw/vicav-app.git),
please do not change the name `vicav-app`
* start a bash in `<basexhome>/webapp/vicav-app`
* run `git submodule update --init --recursive`
* optionally set the CONTENT_REPOsitory and the CONTENT_BRANCH
```bash
# default settings if unset
export CONTENT_REPO=https://github.com/acdh-oeaw/vicav-content
export CONTENT_BRANCH=master
```
* run `./deployment/initial.sh`

This will clone [vicav-content](https://github.com/acdh-oeaw/vicav-content)
Expand Down
8 changes: 4 additions & 4 deletions api-problem.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ declare %private function _:runtime($start as xs:integer) {
((prof:current-ns() - $start) idiv 10000) div 100
};

declare
(: declare :)
(: use when there is another error handler :)
(: %rest:error('Q{https://tools.ietf.org/html/rfc7231#section-6}*') :)
(: use when this is the only error handler :)
Expand All @@ -196,15 +196,15 @@ declare
You could declare all of them in this module
or you could add a call to a lookup function in your module(s)
that will resolve the xs:string to an xs:QName. :)
%rest:error('*')
(: %rest:error('*')
%rest:error-param("code", "{$code}")
%rest:error-param("description", "{$description}")
%rest:error-param("value", "{$value}")
%rest:error-param("module", "{$module}")
%rest:error-param("line-number", "{$line-number}")
%rest:error-param("column-number", "{$column-number}")
%rest:error-param("additional", "{$additional}")
function _:error-handler($code as xs:string, $description, $value, $module, $line-number, $column-number, $additional) as item()+ {
function _:error-handler($code as xs:string, $description, $value, $module, $line-number, $column-number, $additional) as item()+ {
let $start-time-ns := prof:current-ns(),
$origin := try { req:header("Origin") } catch basex:http {'urn:local'},
$type := try {
Expand Down Expand Up @@ -234,7 +234,7 @@ function _:error-handler($code as xs:string, $description, $value, $module, $lin
{if ($_:enable_trace) then <trace xml:space="preserve">{replace(replace($additional, '^.*Stopped at ', '', 's'), ':\n.*($|(\n\nStack Trace:(\n)))', '$3')}</trace> else ()}
</problem>, if (exists($origin)) then map{"Access-Control-Allow-Origin": $origin,
"Access-Control-Allow-Credentials": "true"} else ())
};
}; :)

declare %private function _:on_accept_to_json($problem as element(rfc7807:problem)) {
let $objects := string-join($problem//*[*[local-name() ne '_']]/local-name(), ' '),
Expand Down
16 changes: 16 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
defaultCommandTimeout: 20000,
viewportHeight: 768,
viewportWidth: 1440,
video: true,
videoCompression: true,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
},
})
5 changes: 0 additions & 5 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@ describe('Features', function() {
it('should show clickable markers', function() {
cy.exec(`${BASEX_ROOT}/bin/basexclient -Uadmin -P${BASEX_PWD} -c "OPEN vicav_lingfeatures; REPLACE vicav_lingfeatures_test_toks.xml ${Cypress.config()['fileServerFolder']}/fixtures/vicav_lingfeatures/vicav_lingfeatures_test_toks.xml"`)
cy.visit('http://localhost:8984/vicav/#map=[biblMarkers,_features_,]')
cy.get('#cookie-overlay .cookie-accept-btn').click()
cy.get('.how-to-panel .chrome-close').click()
cy.scrollTo(0, 200)
cy.get('img.leaflet-marker-icon')
cy.get('img[alt^="Tunis2"]').click({force: true})
cy.get('a[data-featurelist="vicav_lingfeatures_tunis2"]').click({force: true})
cy.get('[data-snippetid="vicav_lingfeatures_tunis2"]').contains('h2', 'A List of Linguistic Features of Tunis2 Arabic')
});
cy.wait(800)
});
})

describe('VICAV Compare features window', function() {
it ('shows form with the right behavior', function() {
cy.exec(`${BASEX_ROOT}/bin/basexclient -Uadmin -P${BASEX_PWD} -c "OPEN vicav_lingfeatures; REPLACE vicav_lingfeatures_test2_toks.xml ${Cypress.config()['fileServerFolder']}/fixtures/vicav_lingfeatures/vicav_lingfeatures_test2_toks.xml"`)
cy.server()
cy.route('vicav/data_locations*').as('resources')
cy.route('vicav/explore_samples*').as('results')

cy.intercept('vicav/data_locations*').as('resources')
cy.intercept('vicav/explore_samples*').as('results')

cy.visit('http://localhost:8984/vicav/')

Expand All @@ -25,20 +29,32 @@ describe('VICAV Compare features window', function() {
$navbar_toggler.click()
}
})
cy.get('#cookie-overlay .cookie-accept-btn').click()
cy.get('.how-to-panel .chrome-close').click()
cy.scrollTo(0, 200)
cy.wait(800)
cy.contains('Feature Lists').click()
cy.contains('Cross-examine the VICAV Feature Lists').click()
cy.wait('@resources')
cy.get('.location-wrapper .tagit input').scrollIntoView().type('Tun', {force: true})
cy.get('.location-wrapper .tagit input').type('Tun', {force: true})
cy.get('.tagit-autocomplete .ui-menu-item')
cy.scrollTo(0, 200)
cy.wait(800)
cy.contains('Tunis2').click()
cy.get('.person-wrapper .tagit input').scrollIntoView().type('Tes', {force: true})
cy.get('.person-wrapper .tagit input').type('Tes', {force: true})
cy.get('.tagit-autocomplete .ui-menu-item')
cy.scrollTo(0, 200)
cy.wait(800)
cy.contains('Test1/f/45').click()
cy.get('.features-wrapper .tagit input').scrollIntoView().type('who', {force: true})
cy.get('.features-wrapper .tagit input').type('who', {force: true})
cy.get('.tagit-autocomplete .ui-menu-item')
cy.contains('who?').click()
cy.scrollTo(0, 200)
cy.wait(800)
cy.contains('who?').click()
cy.contains('Compare features').click()
cy.wait('@results', {responseTimeout: 10000})
cy.scrollTo(0, 200)
cy.wait(800)
cy.get('[data-snippetID=compare-features-result]').as('el')
cy.url().should('contain', '[crossFeaturesResult,type|lingfeatures+xslt|cross_features_02.xslt+location|Tunis2+age|0%2C100+person|Test1+features|semlib%3Awho+translation|+comment|+word|+sex|m%2Cf,open]')
cy.get('@el').contains('1 feature sentences found.')
Expand All @@ -51,6 +67,7 @@ describe('VICAV Compare features window', function() {
cy.get($td).contains(expected[index])
})
cy.get('@el').contains('Jendouba')
cy.wait(800)
})
})

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Profiles', function() {

cy.get('img[alt^="Tunis"]').click({force: true})

cy.get('img[src="images/tunis-zeituna-1988.jpg"]').should('be.visible')
cy.get('img[src="http://localhost:8984/vicav/images/tunis-zeituna-1988.jpg"]').should('be.visible')
cy.contains("‏تونس")
});
})
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
File renamed without changes.
Loading

0 comments on commit 373333a

Please sign in to comment.