Skip to content

Commit

Permalink
Merge branch 'Edirom:develop' into ftr-pull_request_template
Browse files Browse the repository at this point in the history
  • Loading branch information
krHERO authored Nov 6, 2024
2 parents 1eab1dd + 29dbe65 commit 6455d3c
Show file tree
Hide file tree
Showing 40 changed files with 714 additions and 692 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ updates:
schedule:
interval: 'weekly'
labels:
- 'gh actions dependencies'
- 'Area: Build & deploy'
76 changes: 63 additions & 13 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pre-release
name: Build, test, and tag

on:
push:
Expand All @@ -10,9 +10,6 @@ on:
permissions:
contents: read

env:
DOCKER_IMAGE: bwbohl/sencha-cmd

jobs:

build:
Expand All @@ -22,13 +19,13 @@ jobs:
contents: write

steps:
- name: Chekout repository
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Get short sha
uses: benjlevesque/short-sha@599815c8ee942a9616c92bcfb4f947a3b670ab0b # v3.0
uses: benjlevesque/[email protected]
id: short-sha
with:
length: 7
Expand All @@ -38,7 +35,7 @@ jobs:

- name: Upload Artifacts to action run
if: github.repository == 'Edirom/Edirom-Online'
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@v4
with:
# The name that the artifact will be made available under
name: EdiromOnline_${{ steps.short-sha.outputs.sha }}.zip
Expand All @@ -47,20 +44,73 @@ jobs:
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
#optional retention-days: 1 to 90

outputs:
# saving this as output for following jobs to pick up
artifact_name: EdiromOnline_${{ steps.short-sha.outputs.sha }}.zip


xqunit:
name: Run XQSuite unit tests
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install libxml2-utils for xmllint
run: |
sudo apt-get update
sudo apt-get install libxml2-utils
- name: Download artifact from previous job
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact_name }}
path: xars
- name: debug
run: ls -laR ${{ github.workspace }}
- name: Create Docker container
run: |
docker create --rm --name edirom-online -p 8080:8080 stadlerpeter/existdb:6
for i in xars/*.xar ; do docker cp $i edirom-online:/opt/exist/autodeploy/ ; done
- name: Run Docker container
run: |
docker start edirom-online
i=0 ; while (! docker inspect edirom-online | grep -e Status....healthy) ; do if ((i > 30)) ; then echo ' **** timeout ... aborting **** ' ; exit 1 ; else sleep 5 ; echo waiting for container ... ; i=$((i+1)) ; fi ; done
- name: Run test suite
run: ant xqunit-tests
- name: Tear down Docker
run: docker kill edirom-online


update-tag:
name: Update git development tag and Github release
needs: [build,xqunit]
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Delete dev-release
if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }}
uses: dev-drprasad/[email protected]
run: gh release delete dev --cleanup-tag -y
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.event.repository.name }}

- name: Download artifact from previous job
uses: actions/download-artifact@v4
with:
delete_release: true
tag_name: dev
github_token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ needs.build.outputs.artifact_name }}
path: xars

- name: Create dev-release
if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }}
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: ${{ github.workspace }}/build-xar/Edirom-Online-*.xar
artifacts: ${{ github.workspace }}/xars/Edirom-Online-*.xar
commit: ${{ github.sha }}
name: "Development Build"
prerelease: true
Expand Down
2 changes: 1 addition & 1 deletion add/data/xql/getAnnotationOpenAllUris.xql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
(: OPTION DECLARATIONS ===================================================== :)

declare option output:method "text";
declare option output:media-type "text/html";
declare option output:media-type "text/plain";

declare function local:getParticipants($annot as element()) as xs:string* {

Expand Down
11 changes: 3 additions & 8 deletions add/data/xql/getAnnotations.xql
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";

(: OPTION DECLARATIONS ===================================================== :)

declare option output:method "text";
declare option output:media-type "text/plain";
declare option output:method "json";
declare option output:media-type "application/json";

let $edition := request:get-parameter('edition', '')
let $uri := request:get-parameter('uri', '')
Expand All @@ -39,11 +39,6 @@ let $map :=
'total': count(doc($uri)//mei:annot[@type = 'editorialComment']),
'annotations': array {annotation:annotationsToJSON($uri, $edition)}
}
let $options :=
map {
'method': 'json',
'media-type': 'text/plain'
}

return
serialize($map, $options)
$map
66 changes: 32 additions & 34 deletions add/data/xql/getAnnotationsInText.xql
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,54 @@ declare namespace xmldb = "http://exist-db.org/xquery/xmldb";

(: OPTION DECLARATIONS ===================================================== :)

declare option output:media-type "text/plain";
declare option output:method "text";
declare option output:method "json";
declare option output:media-type "application/json";

(:~
Finds all annotations in all works.
@param $elems The elements to check (most likely measures and zones)
@returns A sequence of annotation elements
:)
declare function local:findAnnotations($uri as xs:string) as element()* {
declare function local:findAnnotations($uri as xs:string) as element(mei:annot)* {

(: TODO: check if annotations hold URIs or IDRefs :)
collection('/db/contents')//mei:annot[matches(@plist, $uri)]
};

declare function local:getAnnotations($uriSharp as xs:string, $annotations as element()*) as xs:string* {
for $annotation in $annotations
let $id := $annotation/string(@xml:id)
let $uri := concat('xmldb:exist://', document-uri($annotation/root()), '#', $id)
let $prio := $annotation/mei:ptr[@type = "priority"]/replace(@target, '#', '')
let $cat := $annotation/mei:ptr[@type = "categories"]/replace(@target, '#', '')
let $plist :=
for $p in tokenize($annotation/@plist, '\s+')
declare function local:getAnnotations($uriSharp as xs:string, $annotations as element()*) as array(*)* {
array {
for $annotation in $annotations
let $id := $annotation/string(@xml:id)
let $uri := concat('xmldb:exist://', document-uri($annotation/root()), '#', $id)
let $prio := $annotation/mei:ptr[@type = "priority"]/replace(@target, '#', '')
let $cat := $annotation/mei:ptr[@type = "categories"]/replace(@target, '#', '')
let $plist as array(*)* :=
array {
for $p in tokenize($annotation/@plist, '\s+')
return
if (starts-with($p, $uriSharp)) then
(concat('{id:"', $id, '__', substring-after($p, $uriSharp), '"}'))
else
()
}
let $plist := string-join($plist, ',')
return
if (starts-with($p, $uriSharp)) then
(concat('{id:"', $id, '__', substring-after($p, $uriSharp), '"}'))
else
()
let $plist := string-join($plist, ',')
return (: TODO map instead of concat :)
concat('
{',
'id: "', $id, '", ',
'plist: [', $plist, '], ',
'svgList: [], ',
'fn: "loadLink(\"', $uri, '\")", ',
'uri: "', $uri, '", ',
'priority: "', $prio, '", ',
'categories: "', $cat, '"',
'}'
)
map {
'id': $id,
'plist': $plist,
'svgList': [],
'fn': 'loadLink("' || $uri || '")',
'uri': $uri,
'priority': $prio,
'categories': $cat
}
}
};

let $uri := request:get-parameter('uri', '')
let $uriSharp := concat($uri, '#')
let $annotations := local:findAnnotations($uri)

return (: TODO map instead of concat :)
concat(
'[',
string-join(local:getAnnotations($uriSharp, $annotations), ','),
']'
)
return
local:getAnnotations($uriSharp, $annotations)
Loading

0 comments on commit 6455d3c

Please sign in to comment.