Skip to content

Commit cb6e1ae

Browse files
committed
set up optimized pipelines
1 parent c3470c0 commit cb6e1ae

File tree

5 files changed

+50
-24
lines changed

5 files changed

+50
-24
lines changed

.circleci/config.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
version: 2.1
22
parameters:
3+
run_all_tests:
4+
type: boolean
5+
default: false
6+
run_pr_tests:
7+
type: boolean
8+
default: false
9+
run_metamask_tests:
10+
type: boolean
11+
default: false
312
run_flaky_tests:
413
type: boolean
514
default: false
@@ -12,12 +21,7 @@ parameters:
1221
linux:
1322
type: boolean
1423
default: false
15-
web:
16-
type: boolean
17-
default: true
18-
run_metamask_tests:
19-
type: boolean
20-
default: false
24+
2125
orbs:
2226
browser-tools: circleci/[email protected]
2327
win: circleci/[email protected]
@@ -756,6 +760,8 @@ jobs:
756760
type: string
757761
script:
758762
type: string
763+
scriptparameter:
764+
type: string
759765
job:
760766
type: string
761767
jobsize:
@@ -816,7 +822,7 @@ jobs:
816822
install-chromedriver: false
817823
- run: yarn install_webdriver
818824
- run: firefox --version
819-
- run: ./apps/remix-ide/ci/<< parameters.script >> << parameters.browser >> << parameters.jobsize >> << parameters.job >>
825+
- run: ./apps/remix-ide/ci/<< parameters.script >> << parameters.browser >> << parameters.jobsize >> << parameters.job >> << parameters.scriptparameter >>
820826
- store_test_results:
821827
path: ./reports/tests
822828
- store_artifacts:
@@ -969,6 +975,22 @@ workflows:
969975
- build-remixdesktop-linux
970976
- test-remixdesktop-linux
971977

978+
run_pr_tests:
979+
when: << pipeline.parameters.run_pr_tests >>
980+
jobs:
981+
- build
982+
- remix-ide-browser:
983+
requires:
984+
- build
985+
matrix:
986+
parameters:
987+
browser: ["chrome"]
988+
script: ["singletest"]
989+
job: ["nogroup"]
990+
jobsize: ["1"]
991+
parallelism: [1]
992+
scriptparameter: ["pr"]
993+
972994
run_flaky_tests:
973995
when: << pipeline.parameters.run_flaky_tests >>
974996
jobs:
@@ -979,10 +1001,11 @@ workflows:
9791001
matrix:
9801002
parameters:
9811003
browser: ["chrome", "firefox"]
982-
script: ["flaky.sh"]
1004+
script: ["singletest"]
9831005
job: ["nogroup"]
9841006
jobsize: ["1"]
9851007
parallelism: [5]
1008+
scriptparameter: ["flaky"]
9861009

9871010
run_metamask_tests:
9881011
when: << pipeline.parameters.run_metamask_tests >>
@@ -999,7 +1022,7 @@ workflows:
9991022
jobsize: ["1"]
10001023
parallelism: [1]
10011024
web:
1002-
when: << pipeline.parameters.web >>
1025+
when: << pipeline.parameters.run_all_tests >>
10031026
jobs:
10041027
- build
10051028
- build-plugin:

apps/remix-ide-e2e/src/buildGroupTests.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ fs.readdirSync(testFolder).forEach(file => {
1515
if (!file.includes('group')) {
1616
const content = fs.readFileSync(testFolder + file, 'utf8')
1717
const matches = content.match(/group\d+/g)
18-
createFlakyTestFiles(file, content)
18+
createTaggedTestFiles(file, content)
1919
createFiles(file, matches)
2020
}
2121
})
2222

23-
function createFiles(file, matches, flaky = false) {
23+
function createFiles(file, matches, tag = false) {
2424
if (matches) {
2525
const unique = matches.filter(onlyUnique)
2626
unique.map((group) => {
2727
const rewrite = source.replace('#groupname', group).replace('#file', file.replace('.ts', ''))
2828
const extension = file.split('.')
2929
extension.shift()
3030
let filename
31-
if (!flaky) {
31+
if (!tag) {
3232
filename = `${testFolder}${file.split('.').shift()}_${group}.${extension.join('.')}`
3333
} else {
34-
filename = `${testFolder}${file.split('.').shift()}_${group}.flaky.ts`
34+
filename = `${testFolder}${file.split('.').shift()}_${group}.${tag.toLowerCase()}.ts`
3535
}
3636
fs.writeFileSync(filename, rewrite)
3737
})
@@ -42,14 +42,17 @@ function onlyUnique(value, index, self) {
4242
return self.indexOf(value) === index
4343
}
4444

45-
function createFlakyTestFiles(file, text) {
45+
function createTaggedTestFiles(file, text) {
4646
const lines = text.split('\n')
47-
lines.forEach((line, index) => {
48-
// if line contains #flaky
49-
if (line.includes('#flaky')) {
47+
lines.forEach((line) => {
48+
if (line.includes('#flaky') || line.includes('#pr') || line.includes('#PR')) {
5049
const matches = line.match(/group\d+/g)
51-
const unique = matches.filter(onlyUnique)
52-
createFiles(file, matches, true)
50+
if (matches) {
51+
const tags = line.match(/#(flaky|pr|PR)/gi).map(t => t.replace('#', '').toLowerCase());
52+
tags.forEach(tag => {
53+
createFiles(file, matches, tag);
54+
});
55+
}
5356
}
5457
})
5558
}

apps/remix-ide-e2e/src/tests/ballot.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
browser
2121
.addFile('Untitled.sol', sources[0]['Untitled.sol'])
2222
},
23-
'Deploy Ballot #group1': function (browser: NightwatchBrowser) {
23+
'Deploy Ballot #flaky #group1 #pr': function (browser: NightwatchBrowser) {
2424
browser
2525
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
2626
.clickLaunchIcon('solidity')

apps/remix-ide/ci/flaky.sh renamed to apps/remix-ide/ci/singletest.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
set -e
44

5-
TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "\.flaky" | sort )
5+
TESTFILES=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "\.${4}" | sort )
66

77
# count test files
8-
fileCount=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "\.flaky" | wc -l )
8+
fileCount=$(grep -IRiL "\'@disabled\': \?true" "dist/apps/remix-ide-e2e/src/tests" | grep "\.${4}" | wc -l )
99
# if fileCount is 0
1010
if [ $fileCount -eq 0 ]
1111
then
12-
echo "No flaky tests found"
12+
echo "No flaky or PR tests found"
1313
exit 0
1414
fi
1515

projects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4362,7 +4362,7 @@
43624362
"hash": "b99ed2d6b005cdaeffe543b9f95b0c1ccafee7f3"
43634363
},
43644364
{
4365-
"file": "apps/remix-ide/ci/flaky.sh",
4365+
"file": "apps/remix-ide/ci/singletest",
43664366
"hash": "15fefe4c3eae0f283031043bc3c491679e23cf39"
43674367
},
43684368
{

0 commit comments

Comments
 (0)