Skip to content

Commit 9457d2d

Browse files
Merge pull request #4011 from RedisInsight/feature/RI-6214_Migrate_e2e_to_gh_actions
#RI-6214 - migrate e2e to gh actions
2 parents 7df0247 + 451956d commit 9457d2d

27 files changed

+784
-119
lines changed

.github/actions/install-deps/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ runs:
3030
# export npm_config_keytar_binary_host_mirror=${{ inputs.keytar-host-mirror }}
3131
# export npm_config_node_sqlite3_binary_host_mirror=${{ inputs.sqlite3-host-mirror }}
3232
33-
yarn install
33+
yarn install --frozen-lockfile --network-timeout 1000000

.github/e2e-results.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const fs = require('fs');
2+
3+
let parallelNodeInfo = '';
4+
// const totalNodes = parseInt(process.env.NODE_TOTAL, 10);
5+
const totalNodes = 4;
6+
if (totalNodes > 1) {
7+
parallelNodeInfo = ` (node: ${parseInt(process.env.NODE_INDEX, 10) + 1}/${totalNodes})`
8+
}
9+
10+
const file = 'tests/e2e/results/e2e.results.json'
11+
const appBuildType = process.env.APP_BUILD_TYPE || 'Web'
12+
const results = {
13+
message: {
14+
text: `*E2ETest - ${appBuildType}${parallelNodeInfo}* (Branch: *${process.env.GITHUB_REF_NAME}*)` +
15+
`\n<https://github.com/RedisInsight/RedisInsight/actions/runs/${process.env.GITHUB_RUN_ID}|View on Github Actions>`,
16+
attachments: [],
17+
},
18+
};
19+
20+
const result = JSON.parse(fs.readFileSync(file, 'utf-8'))
21+
const testRunResult = {
22+
color: '#36a64f',
23+
title: `Started at: *${result.startTime}`,
24+
text: `Executed ${result.total} in ${(new Date(result.endTime) - new Date(result.startTime)) / 1000}s`,
25+
fields: [
26+
{
27+
title: 'Passed',
28+
value: result.passed,
29+
short: true,
30+
},
31+
{
32+
title: 'Skipped',
33+
value: result.skipped,
34+
short: true,
35+
},
36+
],
37+
};
38+
const failed = result.total - result.passed;
39+
if (failed) {
40+
results.passed = false;
41+
testRunResult.color = '#cc0000';
42+
testRunResult.fields.push({
43+
title: 'Failed',
44+
value: failed,
45+
short: true,
46+
});
47+
}
48+
49+
results.message.attachments.push(testRunResult);
50+
51+
if (results.passed === false) {
52+
results.message.text = '<!here> ' + results.message.text;
53+
}
54+
55+
fs.writeFileSync('e2e.report.json', JSON.stringify({
56+
channel: process.env.SLACK_TEST_REPORT_CHANNEL,
57+
...results.message,
58+
}));

.github/e2e/test.app-image.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -e
3+
4+
yarn --cwd tests/e2e install
5+
6+
# mount app resources
7+
chmod +x ./release/*.AppImage
8+
./release/*.AppImage --appimage-mount >> apppath &
9+
10+
# create folder before tests run to prevent permissions issue
11+
mkdir -p tests/e2e/remote
12+
mkdir -p tests/e2e/rdi
13+
14+
# run rte
15+
docker compose -f tests/e2e/rte.docker-compose.yml build
16+
docker compose -f tests/e2e/rte.docker-compose.yml up --force-recreate -d -V
17+
./tests/e2e/wait-for-redis.sh localhost 12000 && \
18+
19+
# run tests
20+
COMMON_URL=$(tail -n 1 apppath)/resources/app.asar/dist/renderer/index.html \
21+
ELECTRON_PATH=$(tail -n 1 apppath)/redisinsight \
22+
RI_SOCKETS_CORS=true \
23+
yarn --cwd tests/e2e dotenv -e .desktop.env yarn --cwd tests/e2e test:desktop:ci

.github/itest-results.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const fs = require('fs');
2+
3+
const file = 'redisinsight/api/test/test-runs/coverage/test-run-result.json'
4+
5+
const results = {
6+
message: {
7+
text: `*ITest - ${process.env.ITEST_NAME}* (Branch: *${process.env.GITHUB_REF_NAME}*)` +
8+
`\n<https://github.com/RedisInsight/RedisInsight/actions/runs/${process.env.GITHUB_RUN_ID}|View on Github Actions>`,
9+
attachments: [],
10+
},
11+
};
12+
13+
const result = JSON.parse(fs.readFileSync(file, 'utf-8'))
14+
const testRunResult = {
15+
color: '#36a64f',
16+
title: `Started at: ${result.stats.start}`,
17+
text: `Executed ${result.stats.tests} in ${result.stats.duration / 1000}s`,
18+
fields: [
19+
{
20+
title: 'Passed',
21+
value: result.stats.passes,
22+
short: true,
23+
},
24+
{
25+
title: 'Skipped',
26+
value: result.stats.pending,
27+
short: true,
28+
},
29+
],
30+
};
31+
32+
if (result.stats.failures) {
33+
results.passed = false;
34+
testRunResult.color = '#cc0000';
35+
testRunResult.fields.push({
36+
title: 'Failed',
37+
value: result.stats.failures,
38+
short: true,
39+
});
40+
}
41+
42+
results.message.attachments.push(testRunResult);
43+
44+
if (results.passed === false) {
45+
results.message.text = '<!here> ' + results.message.text;
46+
}
47+
48+
fs.writeFileSync('itests.report.json', JSON.stringify({
49+
channel: process.env.SLACK_TEST_REPORT_CHANNEL,
50+
...results.message,
51+
}));

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: 🚀 Build
22

33
on:
44
# Manual trigger build

.github/workflows/compress-images.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
permissions: write-all
1717
runs-on: ubuntu-latest
1818
steps:
19-
- name: Checkout Repo
20-
uses: actions/checkout@v4
19+
- name: Checkout Repo
20+
uses: actions/checkout@v4
2121

22-
- name: Compress Images
23-
uses: calibreapp/image-actions@main
24-
with:
25-
# The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories.
26-
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
27-
githubToken: ${{ secrets.GITHUB_TOKEN }}
22+
- name: Compress Images
23+
uses: calibreapp/image-actions@main
24+
with:
25+
# The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories.
26+
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
27+
githubToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/nightly.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Nightly jobs
2+
on:
3+
schedule:
4+
- cron: 0 0 * * *
5+
6+
jobs:
7+
# Integration tests
8+
build-docker:
9+
uses: ./.github/workflows/pipeline-build-docker.yml
10+
secrets: inherit
11+
12+
integration-tests-nightly:
13+
needs: build-docker
14+
uses: ./.github/workflows/tests-integration.yml
15+
secrets: inherit
16+
with:
17+
build: 'docker'
18+
report: true
19+
short_rte_list: false
20+
21+
# E2E tests
22+
build-appimage:
23+
uses: ./.github/workflows/pipeline-build-linux.yml
24+
secrets: inherit
25+
with:
26+
target: 'linux:appimage:x64'
27+
28+
e2e-appimage-nightly:
29+
uses: ./.github/workflows/tests-e2e-appimage.yml
30+
needs: build-appimage
31+
secrets: inherit
32+
with:
33+
report: true

.github/workflows/pipeline-build-docker.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
required: false
88
default: 'staging'
99
type: string
10+
only_docker:
11+
description: Build only docker
12+
required: false
13+
default: false
14+
type: boolean
1015

1116
jobs:
1217
build:
@@ -28,7 +33,7 @@ jobs:
2833
- name: Build sources
2934
run: ./.circleci/build/build.sh
3035

31-
# todo: matrix
36+
# todo: matrix
3237
- name: Build web archives
3338
run: |
3439
unset npm_config_keytar_binary_host_mirror
@@ -82,15 +87,17 @@ jobs:
8287

8388
- uses: actions/upload-artifact@v4
8489
name: Upload web-mini artifacts
90+
if: ${{ !inputs.only_docker }}
8591
with:
86-
if-no-files-found: error
92+
if-no-files-found: warn
8793
name: web-mini
8894
path: ./release/web-mini
8995

9096
- uses: actions/upload-artifact@v4
9197
name: Upload web artifacts
98+
if: ${{ !inputs.only_docker }}
9299
with:
93-
if-no-files-found: error
100+
if-no-files-found: warn
94101
name: web
95102
path: ./release/web
96103

.github/workflows/pipeline-build-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
# ssh
2929
# - run: sudo apt-get update -qy && sudo apt-get install -qy tmux;
3030
# - name: Setup upterm session
31-
# - uses: mxschmitt/action-tmate #1 better
31+
# - uses: mxschmitt/action-tmate@v3 #1 better
3232
# uses: lhotari/action-upterm@v1 #2
3333
# with:
3434
# limit-access-to-actor: true
@@ -83,6 +83,7 @@ jobs:
8383
name: linux-appimage-build
8484
path: |
8585
./release/Redis-Insight*.AppImage
86+
./release/latest-linux.yml
8687
8788
- uses: actions/upload-artifact@v4
8889
name: Upload Deb artifact
@@ -104,7 +105,6 @@ jobs:
104105
name: linux-snap-builds
105106
path: |
106107
./release/Redis-Insight*.snap
107-
./release/latest-linux.yml
108108
109109
env:
110110
RI_AI_CONVAI_TOKEN: ${{ secrets.RI_AI_CONVAI_TOKEN }}

.github/workflows/pull-request-created.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)