Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066701
D1716.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Subscribers
None
D1716.id.diff
View Options
diff --git a/jobs/swh-packages.yaml b/jobs/swh-packages.yaml
--- a/jobs/swh-packages.yaml
+++ b/jobs/swh-packages.yaml
@@ -164,3 +164,6 @@
pkg: web
jobs:
- 'swh-jobs-{name}'
+ - '{name}/cypress'
+ - '{name}/cypress/diff'
+
diff --git a/jobs/templates/swh-cypress.groovy b/jobs/templates/swh-cypress.groovy
new file mode 100644
--- /dev/null
+++ b/jobs/templates/swh-cypress.groovy
@@ -0,0 +1,85 @@
+pipeline {{
+
+ agent {{
+ agent {{ label '{docker-image}' }}
+ }}
+
+ environment {{
+ PHAB_CONDUIT_URL = 'https://forge.softwareheritage.org/api/'
+ }}
+
+ stages {{
+
+ stage('Checkout') {{
+ steps {{
+ withCredentials([
+ string(credentialsId: 'swh-public-ci',
+ variable: 'PHAB_CONDUIT_TOKEN')]) {{
+ sh '''
+ if [ -n "$PHID" ]; then
+ python3 -m pyarcanist send-message work $PHID
+ fi
+ '''
+ }}
+ checkout([$class: 'GitSCM',
+ branches: [[name: "${{params.REVISION}}"]],
+ doGenerateSubmoduleConfigurations: false,
+ extensions: [],
+ gitTool: 'Default',
+ submoduleCfg: [],
+ userRemoteConfigs: [[url: 'https://forge.softwareheritage.org/source/{display-name}.git']]
+ ])
+ }}
+ }}
+
+ stage('Setup environment') {{
+ steps {{
+ sh '''#!/bin/bash
+ python3 -m venv /swh-web-env
+ source ~/swh-web-env/bin/activate
+ pip3 install wheel
+ pip3 install -e .[testing]
+ yarn install && yarn build-dev && yarn run cypress install
+ '''
+ }}
+ }}
+
+ stage('Run cypress tests') {{
+ steps {{
+ sh '''#!/bin/bash
+ source ~/swh-web-env/bin/activate
+ export PYTHONPATH=$PWD
+ python3 swh/web/manage.py migrate
+ python3 swh/web/manage.py createcachetable
+ python3 swh/web/manage.py runserver --nostatic --settings=swh.web.settings.tests &
+ wait-for-it localhost:5004
+ yarn run cypress run
+ '''
+ }}
+ }}
+
+ }}
+
+ post {{
+ always {{
+ withCredentials([
+ string(credentialsId: 'swh-public-ci',
+ variable: 'PHAB_CONDUIT_TOKEN')]) {{
+ withEnv(["JOBSTATUS=${{currentBuild.currentResult}}"]) {{
+ sh '''
+ if [ "$JOBSTATUS" = "SUCCESS" ]; then
+ MSGTYPE=pass
+ else
+ MSGTYPE=fail
+ fi
+ echo "Current job status is $JOBSTATUS -> $MGSTYPE"
+ if [ -n "$PHID" ]; then
+ python3 -m pyarcanist send-message $MSGTYPE $PHID
+ fi
+ '''
+ }}
+ }}
+ }}
+ }}
+
+}}
\ No newline at end of file
diff --git a/jobs/templates/swh-cypress.yaml b/jobs/templates/swh-cypress.yaml
new file mode 100644
--- /dev/null
+++ b/jobs/templates/swh-cypress.yaml
@@ -0,0 +1,80 @@
+- job-template:
+ name: "{name}/cypress"
+ display-name: "master branch (cypress)"
+ project-type: pipeline
+ docker-image: swh-cypress
+ triggers:
+ - timed: '@daily'
+ sandbox: true
+ auth-token: 'ph4br1cat0r'
+ properties:
+ - build-discarder:
+ num-to-keep: 20
+ parameters:
+ - git-parameter:
+ name: REVISION
+ type: PT_REVISION
+ defaultValue: master
+ description: Git revision to build.
+ - string:
+ name: PHID
+ description: PHID of the Phabricator target object on which results will be reported.
+
+ dsl:
+ !include-raw: swh-cypress.groovy
+
+
+- job-template:
+ name: "{name}/cypress/diff"
+ display-name: 'Phab. Diff (cypress)'
+ docker-image: swh-cypress
+ node: "{docker-image}"
+ auth-token: ph4br1cat0r
+ parameters:
+ - string:
+ name: REPO
+ description: PHID of the Diffusion repository
+ - string:
+ name: PHID
+ description: PHID of the Target object
+ - string:
+ name: DIFF_ID
+ description: ID of the Diff patch to apply, if any
+ scm:
+ - git:
+ url: https://forge.softwareheritage.org/source/{display-name}.git
+
+ wrappers:
+ - phabricator-differential:
+ apply-to-master: true
+ patch-with-force-flag: true
+
+
+ builders:
+ - shell: |
+ echo "Run cypress for:"
+ echo " REPO=$REPO"
+ echo " PHID=$PHID"
+ echo " DIFF_ID=$DIFF_ID"
+ - shell: |
+ #!/bin/bash
+ python3 -m venv ~/swh-web-env
+ source ~/swh-web-env/bin/activate
+ pip3 install wheel
+ pip3 install -e .[testing]
+ yarn install && yarn build-dev && yarn run cypress install
+ export PYTHONPATH=$PWD
+ python3 swh/web/manage.py migrate
+ python3 swh/web/manage.py createcachetable
+ python3 swh/web/manage.py runserver --nostatic --settings=swh.web.settings.tests &
+ wait-for-it localhost:5004
+ yarn run cypress run
+
+ publishers:
+ - phabricator:
+ uberalls-enabled: false
+ comment-on-success: true
+ comment-with-console-link-on-failure: true
+ process-lint: true
+ lint-file: .phabricator-lint
+ lint-file-size: 1000000
diff --git a/jobs/templates/swh-pypi.groovy b/jobs/templates/swh-pypi.groovy
--- a/jobs/templates/swh-pypi.groovy
+++ b/jobs/templates/swh-pypi.groovy
@@ -32,6 +32,23 @@
}}
}}
+ stage('Run cypress tests') {{
+ when {{
+ expression {{ '{display-name}' == 'swh-web' && !params.SKIP_TESTS }}
+ beforeAgent true
+ }}
+ agent none
+ steps {{
+ build(
+ job: '/{name}/cypress',
+ parameters: [
+ string(name: 'REVISION', value: params.GIT_TAG),
+ ],
+ propagate: !params.IGNORE_TESTS,
+ )
+ }}
+ }}
+
stage('Checkout') {{
steps {{
checkout([$class: 'GitSCM',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 6:40 PM (11 w, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3215575
Attached To
D1716: Add Jenkins jobs to run cypress tests for swh-web
Event Timeline
Log In to Comment