@@ -161,7 +161,9 @@ jobs:
161161
162162 - name : Copy code
163163 shell : bash
164- run : cp -rf ./* /opt/countly
164+ run : |
165+ cp -rf ./* /opt/countly
166+ cp ./bin/docker/postinstall.sh /etc/my_init.d
165167
166168 - name : Remove plugin tests
167169 shell : bash
@@ -287,7 +289,12 @@ jobs:
287289
288290 - name : Copy code
289291 shell : bash
290- run : cp -rf ./* /opt/countly
292+ run : |
293+ rm -rf /opt/countly/frontend
294+ rm -rf /opt/countly/plugins/old-ui-compatibility
295+ cp -rf ./* /opt/countly
296+ cp /opt/countly/frontend/express/config.sample.js /opt/countly/frontend/express/config.js
297+ cp /opt/countly/frontend/express/public/javascripts/countly/countly.config.sample.js /opt/countly/frontend/express/public/javascripts/countly/countly.config.js
291298
292299 - name : Prepare files to use correct MongoDB host
293300 shell : bash
@@ -341,3 +348,82 @@ jobs:
341348 mkdir -p screenshots videos downloads
342349 tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos downloads
343350 curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME"
351+
352+ ui-test-sdk :
353+ runs-on : ubuntu-latest
354+
355+ services :
356+ mongodb :
357+ image : mongo:8.0
358+ options : >-
359+ --health-cmd mongosh
360+ --health-interval 10s
361+ --health-timeout 5s
362+ --health-retries 5
363+ ports :
364+ - 27017:27017
365+
366+ container :
367+ image : countly/countly-core:pipelines-${{ inputs.custom_tag || github.base_ref || github.ref_name }}
368+ env :
369+ COUNTLY_CONFIG__MONGODB_HOST : mongodb
370+ COUNTLY_CONFIG_API_PREVENT_JOBS : true
371+
372+ steps :
373+ - uses : actions/checkout@v2
374+
375+ - name : Install Chrome
376+ shell : bash
377+ run : |
378+ apt update
379+ apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb wget
380+ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb
381+ apt install -y /tmp/chrome.deb
382+
383+ - name : Copy code
384+ shell : bash
385+ run : cp -rf ./* /opt/countly
386+
387+ - name : Prepare files to use correct MongoDB host
388+ shell : bash
389+ run : " sed -i 's/mongosh --quiet/mongosh --host mongodb --quiet/' /opt/countly/bin/backup/import_events.sh && sed -i 's/mongoimport --db/mongoimport --host mongodb --db/' /opt/countly/bin/backup/import_events.sh"
390+
391+ - name : NPM install
392+ shell : bash
393+ working-directory : /opt/countly
394+ run : npm install
395+
396+ - name : Prepare environment
397+ shell : bash
398+ working-directory : /opt/countly
399+ run : |
400+ sed -i 's/port: 3001,/port: 3001, workers: 1,/' /opt/countly/api/config.js
401+ cp "./plugins/plugins.default.json" "/opt/countly/plugins/plugins.json"
402+ npm install
403+ sudo countly task dist-all
404+ bash bin/scripts/countly.prepare.ce.tests.sh
405+ cd ui-tests
406+ echo '{"username": "${{ secrets.CYPRESS_USER_USERNAME }}","email": "${{ secrets.CYPRESS_USER_EMAIL }}","password": "${{ secrets.CYPRESS_USER_PASSWORD }}"}' > cypress/fixtures/user.json
407+ sed -i 's/00000000-0000-0000-0000-000000000000/${{ secrets.CYPRESS_KEY }}/g' package.json
408+ cp cypress.config.sample.js cypress.config.js
409+ sed -i 's/000000/${{ secrets.CYPRESS_PROJECT_ID }}/g' cypress.config.js
410+
411+ - name : Run UI tests
412+ shell : bash
413+ working-directory : /opt/countly
414+ run : |
415+ /sbin/my_init &
416+ cd ui-tests
417+ npm install
418+ xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
419+ npm run cy:run:sdk
420+
421+ - name : Upload UI tests artifacts
422+ if : ${{ failure() }}
423+ shell : bash
424+ working-directory : /opt/countly/ui-tests/cypress
425+ run : |
426+ ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}_ui_test_sdk.tar.gz"
427+ mkdir -p screenshots videos
428+ tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos
429+ curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME"
0 commit comments