Skip to content

Commit 422385a

Browse files
committed
Merge remote-tracking branch 'origin/master' into sync-master-into-the-next
2 parents ebe46ff + 1004508 commit 422385a

File tree

34 files changed

+709
-645
lines changed

34 files changed

+709
-645
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -244,96 +244,13 @@ jobs:
244244
/sbin/my_init &
245245
node bin/scripts/test.connection.js
246246
npx grunt mochaTest
247-
ui-test-dashboard:
248-
runs-on: ubuntu-22.04-4core
249247
250-
services:
251-
mongodb:
252-
image: mongo:8.0
253-
options: >-
254-
--health-cmd mongosh
255-
--health-interval 10s
256-
--health-timeout 5s
257-
--health-retries 5
258-
ports:
259-
- 27017:27017
260-
261-
container:
262-
image: countly/countly-core:pipelines-${{ inputs.custom_tag || github.base_ref || github.ref_name }}
263-
env:
264-
COUNTLY_CONFIG__MONGODB_HOST: mongodb
265-
COUNTLY_CONFIG_API_PREVENT_JOBS: true
266-
267-
steps:
268-
- uses: actions/checkout@v4
269-
270-
- name: Install Chrome
271-
shell: bash
272-
run: |
273-
apt update
274-
apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb wget
275-
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb
276-
apt install -y /tmp/chrome.deb
277-
278-
- name: Copy code
279-
shell: bash
280-
run: |
281-
rm -rf /opt/countly/frontend
282-
rm -rf /opt/countly/plugins/old-ui-compatibility
283-
cp -rf ./* /opt/countly
284-
cp /opt/countly/frontend/express/config.sample.js /opt/countly/frontend/express/config.js
285-
cp /opt/countly/frontend/express/public/javascripts/countly/countly.config.sample.js /opt/countly/frontend/express/public/javascripts/countly/countly.config.js
286-
287-
- name: Prepare files to use correct MongoDB host
288-
shell: bash
289-
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"
290-
291-
- name: NPM install
292-
shell: bash
293-
working-directory: /opt/countly
294-
run: npm install
295-
296-
- name: Prepare environment
297-
shell: bash
298-
working-directory: /opt/countly
299-
run: |
300-
sed -i 's/port: 3001,/port: 3001, workers: 1,/' /opt/countly/api/config.js
301-
cp "./plugins/plugins.default.json" "/opt/countly/plugins/plugins.json"
302-
npm install
303-
sudo countly task dist-all
304-
bash bin/backup/import_events.sh
305-
bash bin/scripts/countly.prepare.ce.tests.sh
306-
countly add_user '${{ secrets.CYPRESS_USER_EMAIL }}' '${{ secrets.CYPRESS_USER_PASSWORD }}'
307-
mongosh --host mongodb --eval 'db.getSiblingDB("countly").members.updateOne({username: "${{ secrets.CYPRESS_USER_EMAIL }}"}, {$set: {username: "${{ secrets.CYPRESS_USER_USERNAME }}", subscribe_newsletter: true}});'
308-
mongosh --host mongodb --eval 'db.getSiblingDB("countly").plugins.updateOne({_id: "plugins"}, {$set: {"frontend.countly_tracking": true}});'
309-
cd ui-tests
310-
echo '{"username": "${{ secrets.CYPRESS_USER_USERNAME }}","email": "${{ secrets.CYPRESS_USER_EMAIL }}","password": "${{ secrets.CYPRESS_USER_PASSWORD }}"}' > cypress/fixtures/user.json
311-
sed -i 's/00000000-0000-0000-0000-000000000000/${{ secrets.CYPRESS_KEY }}/g' package.json
312-
cp cypress.config.sample.js cypress.config.js
313-
sed -i 's/000000/${{ secrets.CYPRESS_PROJECT_ID }}/g' cypress.config.js
314-
315-
- name: Run UI tests
316-
shell: bash
317-
working-directory: /opt/countly
318-
run: |
319-
/sbin/my_init &
320-
cd ui-tests
321-
npm install
322-
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
323-
npm run cy:run:dashboard
324-
325-
- name: Upload UI tests artifacts
326-
if: ${{ failure() }}
327-
shell: bash
328-
working-directory: /opt/countly/ui-tests/cypress
329-
run: |
330-
ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}.tar.gz"
331-
mkdir -p screenshots videos
332-
tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos
333-
curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME"
248+
ui-tests:
249+
runs-on: ubuntu-latest
334250

335-
ui-test-onboarding:
336-
runs-on: ubuntu-22.04-4core
251+
strategy:
252+
matrix:
253+
test_type: [dashboard, onboarding]
337254

338255
services:
339256
mongodb:
@@ -371,7 +288,7 @@ jobs:
371288
cp -rf ./* /opt/countly
372289
cp /opt/countly/frontend/express/config.sample.js /opt/countly/frontend/express/config.js
373290
cp /opt/countly/frontend/express/public/javascripts/countly/countly.config.sample.js /opt/countly/frontend/express/public/javascripts/countly/countly.config.js
374-
291+
375292
- name: Prepare files to use correct MongoDB host
376293
shell: bash
377294
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"
@@ -389,7 +306,13 @@ jobs:
389306
cp "./plugins/plugins.default.json" "/opt/countly/plugins/plugins.json"
390307
npm install
391308
sudo countly task dist-all
309+
bash bin/backup/import_events.sh
392310
bash bin/scripts/countly.prepare.ce.tests.sh
311+
if [ "${{ matrix.test_type }}" = "dashboard" ]; then
312+
countly add_user '${{ secrets.CYPRESS_USER_EMAIL }}' '${{ secrets.CYPRESS_USER_PASSWORD }}'
313+
mongosh --host mongodb --eval 'db.getSiblingDB("countly").members.updateOne({username: "${{ secrets.CYPRESS_USER_EMAIL }}"}, {$set: {username: "${{ secrets.CYPRESS_USER_USERNAME }}", subscribe_newsletter: true}});'
314+
mongosh --host mongodb --eval 'db.getSiblingDB("countly").plugins.updateOne({_id: "plugins"}, {$set: {"frontend.countly_tracking": true}});'
315+
fi
393316
cd ui-tests
394317
echo '{"username": "${{ secrets.CYPRESS_USER_USERNAME }}","email": "${{ secrets.CYPRESS_USER_EMAIL }}","password": "${{ secrets.CYPRESS_USER_PASSWORD }}"}' > cypress/fixtures/user.json
395318
sed -i 's/00000000-0000-0000-0000-000000000000/${{ secrets.CYPRESS_KEY }}/g' package.json
@@ -403,15 +326,18 @@ jobs:
403326
/sbin/my_init &
404327
cd ui-tests
405328
npm install
406-
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" \
407-
npm run cy:run:onboarding
329+
if [ "${{ matrix.test_type }}" = "dashboard" ]; then
330+
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" npm run cy:run:dashboard
331+
else
332+
xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24" npm run cy:run:onboarding
333+
fi
408334
409335
- name: Upload UI tests artifacts
410336
if: ${{ failure() }}
411337
shell: bash
412338
working-directory: /opt/countly/ui-tests/cypress
413339
run: |
414-
ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}.tar.gz"
340+
ARTIFACT_ARCHIVE_NAME="$(date '+%Y%m%d-%H.%M')_${GITHUB_REPOSITORY#*/}_CI#${{ github.run_number }}_${{ matrix.test_type }}.tar.gz"
415341
mkdir -p screenshots videos
416342
tar zcvf "$ARTIFACT_ARCHIVE_NAME" screenshots videos
417343
curl -o /tmp/uploader.log -u "${{ secrets.BOX_UPLOAD_AUTH }}" ${{ secrets.BOX_UPLOAD_PATH }} -T "$ARTIFACT_ARCHIVE_NAME"

Dockerfile-api

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ RUN apt-get update && \
3030
RUN apt-get update && \
3131
apt-get upgrade -y && \
3232
cd /usr/src && \
33-
wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz && \
34-
tar -xf Python-3.8.12.tar.xz && \
35-
apt-get install -y build-essential sudo zlib1g-dev libssl3 libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev && \
36-
cd Python-3.8.12 && \
33+
wget https://www.python.org/ftp/python/3.8.20/Python-3.8.20.tar.xz && \
34+
tar -xf Python-3.8.20.tar.xz && \
35+
apt-get install -y build-essential sudo zlib1g-dev libssl3 libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev && \
36+
cd Python-3.8.20 && \
3737
./configure --enable-optimizations --enable-shared && \
3838
make && \
3939
make altinstall && \
40-
ldconfig /usr/src/Python-3.8.12 && \
41-
ln -s /usr/local/bin/python3.8 /usr/bin/python3
40+
ldconfig /usr/src/Python-3.8.20 && \
41+
ln -sf /usr/local/bin/python3.8 /usr/bin/python3
4242

4343
RUN curl -s -L -o /tmp/tini.deb "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" && \
4444
dpkg -i /tmp/tini.deb && \
@@ -54,13 +54,16 @@ RUN curl -s -L -o /tmp/tini.deb "https://github.com/krallin/tini/releases/downlo
5454
HOME=/tmp npm install argon2 --build-from-source --unsafe-perm=true --allow-root && \
5555
./bin/docker/preinstall.sh && \
5656
bash /opt/countly/bin/scripts/detect.init.sh && \
57+
python3.8 -m pip install --upgrade pip setuptools && \
5758
\
5859
# cleanup & chown
5960
npm remove -y --no-save mocha nyc should supertest && \
60-
apt-get remove -y git gcc g++ make automake autoconf libtool pkg-config unzip wget && \
61+
apt-get purge -y python3 python3-pip python3-distutils python3-setuptools && \
62+
apt-get remove -y git gcc g++ make automake autoconf libtool pkg-config unzip sqlite3 wget && \
6163
apt-get install -y libgbm-dev libgbm1 gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils && \
6264
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
63-
rm -rf test /tmp/* /tmp/.??* /var/tmp/* /var/tmp/.??* /var/log/* /root/.npm && \
65+
apt-get autoremove -y && \
66+
rm -rf test /tmp/* /tmp/.??* /var/tmp/* /var/tmp/.??* /var/log/* /root/.npm /usr/local/lib/python3.8/ensurepip/_bundled/*.whl /usr/src/Python* /var/lib/dpkg/info/python3* && \
6467
\
6568
# temporary to remove npm bug message
6669
mkdir /.npm && chown -R 1001:0 /.npm && \
@@ -75,4 +78,4 @@ USER 1001:0
7578

7679
ENTRYPOINT ["/usr/bin/tini", "-v", "--"]
7780

78-
CMD ["/opt/countly/bin/docker/cmd.sh"]
81+
CMD ["/opt/countly/bin/docker/cmd.sh"]

Dockerfile-frontend

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ RUN apt-get update && \
2626
RUN apt-get update && \
2727
apt-get upgrade -y && \
2828
cd /usr/src && \
29-
wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz && \
30-
tar -xf Python-3.8.12.tar.xz && \
31-
apt-get install -y build-essential sudo zlib1g-dev libssl3 libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl libbz2-dev && \
32-
cd Python-3.8.12 && \
29+
wget https://www.python.org/ftp/python/3.8.20/Python-3.8.20.tar.xz && \
30+
tar -xf Python-3.8.20.tar.xz && \
31+
apt-get install -y build-essential sudo zlib1g-dev libssl3 libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev && \
32+
cd Python-3.8.20 && \
3333
./configure --enable-optimizations --enable-shared && \
3434
make && \
3535
make altinstall && \
36-
ldconfig /usr/src/Python-3.8.12 && \
37-
ln -s /usr/local/bin/python3.8 /usr/bin/python3
36+
ldconfig /usr/src/Python-3.8.20 && \
37+
ln -sf /usr/local/bin/python3.8 /usr/bin/python3
3838

3939
RUN curl -s -L -o /tmp/tini.deb "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" && \
4040
dpkg -i /tmp/tini.deb && \
@@ -51,14 +51,17 @@ RUN curl -s -L -o /tmp/tini.deb "https://github.com/krallin/tini/releases/downlo
5151
HOME=/tmp npm install argon2 --build-from-source --unsafe-perm=true --allow-root && \
5252
./bin/docker/preinstall.sh && \
5353
bash /opt/countly/bin/scripts/detect.init.sh && \
54-
countly update sdk-web && \
54+
python3.8 -m pip install --upgrade pip setuptools && \
55+
countly update sdk-web && \
5556
\
5657
# cleanup & chown
5758
npm remove -y --no-save mocha nyc should supertest puppeteer && \
58-
apt-get remove -y git gcc g++ make automake autoconf libtool pkg-config unzip wget && \
59+
apt-get purge -y python3 python3-pip python3-distutils python3-setuptools && \
60+
apt-get remove -y git gcc g++ make automake autoconf libtool pkg-config unzip sqlite3 wget && \
5961
apt-get autoremove -y && \
6062
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
61-
rm -rf test /tmp/* /tmp/.??* /var/tmp/* /var/tmp/.??* /var/log/* /root/.npm && \
63+
apt-get autoremove -y && \
64+
rm -rf test /tmp/* /tmp/.??* /var/tmp/* /var/tmp/.??* /var/log/* /root/.npm /usr/local/lib/python3.8/ensurepip/_bundled/*.whl /usr/src/Python* /var/lib/dpkg/info/python3* && \
6265
\
6366
# temporary to remove npm bug message
6467
mkdir /.npm && chown -R 1001:0 /.npm && \

0 commit comments

Comments
 (0)