Skip to content

Commit

Permalink
Integrate Cypress e2e tests into CI (#1152)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Smit <[email protected]>
  • Loading branch information
nicwells and smitfire authored Sep 17, 2022
1 parent 503b024 commit a3e900e
Show file tree
Hide file tree
Showing 23 changed files with 1,128 additions and 178 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ on: [pull_request]

jobs:
test-and-build:
runs-on: ubuntu-latest
runs-on: it

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- name: install dependencies 🚀
run: |
yarn
yarn install --frozen-lockfile # optional, --immutable
- name: linting ✨
run: |
yarn lint
Expand All @@ -24,6 +27,24 @@ jobs:
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: build project 👷
- name: build fusion docker image
run: |
docker build . --tag=nexus-web:latest
- name: Start services
run: docker-compose -f ci/docker-compose.yml up -d && sleep 60
- name: Copy nexus-web into Cypress container
# avoids permission issue where cypress writes screenshots to host with root as user
# which we can't then delete easily
run: docker cp ./. cypress:/e2e
- name: e2e tests
run: echo | docker exec -t cypress cypress run --config-file cypress.config.ts --browser chrome --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Stop Docker
if: ${{ always() }}
run: docker-compose -f ci/docker-compose.yml down && sleep 60
- name: Cleanup Docker Containers
if: ${{ always() }}
run: |
yarn build
for container in `docker images | grep none | awk '{print $3}'`; do
echo "Deleting container: $container";
docker rmi $container;
done
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ coverage/
yarn-error.log
cypress/screenshots/
cypress/videos/
cypress.env.json
*.iml
.idea
99 changes: 99 additions & 0 deletions ci/config/construct-query.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
prefix prov: <http://www.w3.org/ns/prov#>
prefix nsg: <https://neuroshapes.org/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix schema: <http://schema.org/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix nxv: <https://bluebrain.github.io/nexus/vocabulary/>
prefix field: <https://bluebrain.github.io/nexus/field/>


CONSTRUCT {
{resource_id} a ?type ;
schema:name ?name ;
field:description ?description ;
field:brainRegion ?brainRegionBN ;
field:project ?projectBN ;
field:subjectSpecies ?speciesBN ;
field:contributors ?personBN ;
field:organizations ?orgBN ;
field:license ?licenseBN ;
field:createdBy ?createdBy ;
nxv:self ?self .

?projectBN field:identifier ?projectId ;
rdfs:label ?projectLabel .

?licenseBN field:identifier ?licenseId ;
rdfs:label ?licenseLabel .

?brainRegionBN field:identifier ?brainRegionId ;
rdfs:label ?brainRegionLabel .

?speciesBN field:identifier ?speciesId ;
rdfs:label ?speciesLabel .

?personBN field:identifier ?personId ;
rdfs:label ?personName .

?orgBN field:identifier ?orgId ;
rdfs:label ?organizationName .

?mTypeBN field:identifier ?mTypeId ;
rdfs:label ?mTypeLabel
} WHERE {
{resource_id} nxv:createdAt ?createdAt;
nxv:createdBy ?createdBy;
nxv:self ?self;
a ?type ;
nxv:project ?projectId .
?projectId nxv:organizationLabel ?orgLabel;
nxv:label ?projLabel.
BIND (CONCAT(STR(?orgLabel),STR("/"),STR(?projLabel)) as ?projectLabel) .
BIND(BNODE() AS ?projectBN) .

OPTIONAL { {resource_id} schema:description ?description } .
OPTIONAL { {resource_id} schema:name ?name } .
OPTIONAL { {resource_id} rdfs:label ?name } .
OPTIONAL { {resource_id} skos:prefLabel ?name } .
OPTIONAL {
{resource_id} schema:license ?licenseId .
BIND(BNODE() AS ?licenseBN) .
OPTIONAL { ?licenseId rdfs:label ?licenseLabel . }
} .

OPTIONAL {
{resource_id} nsg:brainLocation / nsg:brainRegion ?brainRegionId .
BIND(BNODE() AS ?brainRegionBN) .
OPTIONAL { ?brainRegionId rdfs:label ?brainRegionLabel }
} .

OPTIONAL {
{resource_id} nsg:subject / nsg:species ?speciesId .
BIND(BNODE() AS ?speciesBN) .
OPTIONAL { ?speciesId rdfs:label ?speciesLabel }
} .

OPTIONAL {
{resource_id} nsg:contribution / prov:agent ?personId .
?personId a schema:Person .
BIND(BNODE() AS ?personBN) .
OPTIONAL { ?personId schema:givenName ?givenName } .
OPTIONAL { ?personId schema:familyName ?familyName } .
BIND(IF(BOUND(?givenName) && BOUND(?familyName), CONCAT(STR(?givenName)," ", STR(?familyName)), IF(BOUND(?givenName), ?givenName, ?familyName)) AS ?personName)
} .

OPTIONAL {
{resource_id} nsg:contribution / prov:agent ?orgId .
?orgId a schema:Organization .
BIND(BNODE() AS ?orgBN) .
OPTIONAL { ?orgId schema:name ?organizationName }
} .

OPTIONAL {
{resource_id} nsg:annotation / nsg:hasBody ?mTypeId .
?mTypeId a nsg:MType .
BIND(BNODE() AS ?mTypeBN) .
OPTIONAL { ?mTypeId rdfs:label ?mTypeLabel }
}
}
96 changes: 96 additions & 0 deletions ci/config/delta-postgres.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
jdbc-read-journal.refresh-interval = 500 millis

app {
http {
base-uri = "http://delta:8080/v1"
interface = 0.0.0.0
}
cluster.seeds = "delta:25520"

database {
flavour = "postgres"
postgres {
host = "postgres"
tables-autocreate = true
}
deny-cleanup = false
}

fusion {
base = "https://bbp.epfl.ch/nexus/web/"
enable-redirects = true
}
}

postgres {
db {
numThreads = 5
maxConnections = 5
minConnections = 1
}
}

plugins {
blazegraph {
base = "http://blazegraph:9999/blazegraph"

indexing {
max-batch-size = 50
max-time-window = 50 millis
}
}

composite-views {
min-interval-rebuild = 5 seconds

sources {
max-batch-size = 50
max-time-window = 50 millis
}
}

elasticsearch {
base = "http://elasticsearch:9200"
credentials {
username = "elastic"
password = "password"
}

indexing {
max-batch-size = 50
max-time-window = 50 millis
}
}

graph-analytics {
enabled = true
}

search {
enabled = true
fields = "/config/fields.json"
indexing {
context = "/config/search-context.json"
mapping = "/config/mapping.json"
settings = "/config/settings.json"
query = "/config/construct-query.sparql"
resource-types = "/config/resource-types.json"
}
}

storage {
storages {
disk {
default-volume= "/default-volume"
}

remote-disk {
enabled = false
}

amazon {
enabled = false
}
}
}
}
Loading

0 comments on commit a3e900e

Please sign in to comment.