Skip to content

Commit a211966

Browse files
author
Wang, Gang(Gary)
committed
MNEMONIC-329: Travis Continuous Integration
MNEMONIC-331: Circle Continuous Integration
1 parent a4bb10e commit a211966

File tree

4 files changed

+90
-6
lines changed

4 files changed

+90
-6
lines changed

.circleci/config.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
version: 2
19+
jobs:
20+
build:
21+
working_directory: /ws/incubator-mnemonic
22+
docker:
23+
- image: mnemonic/mneci
24+
branches:
25+
only:
26+
- master
27+
steps:
28+
- run:
29+
name: Clean up
30+
command: |
31+
rm -rf /ws/incubator-mnemonic
32+
- checkout
33+
- run:
34+
name: Run tests
35+
command: |
36+
git log -1 --stat
37+
git clean -xdf
38+
mvn clean install
39+
# the runall cannot be fullfilled with free plan since it needs more resource to run.
40+
# bin/runall.sh

.travis.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
sudo: required
19+
dist: trusty
20+
language: python
21+
python:
22+
- 2.7
23+
24+
services:
25+
- docker
26+
27+
branches:
28+
only:
29+
- master
30+
31+
before_install:
32+
- docker pull mnemonic/mneci
33+
- docker images
34+
35+
install:
36+
- pip install mock
37+
38+
script:
39+
- ls -l $TRAVIS_BUILD_DIR
40+
- docker run -v $TRAVIS_BUILD_DIR:/ws/incubator-mnemonic --rm -t mnemonic/mneci /bin/bash -c "cd /ws/incubator-mnemonic; git log -1 --stat; git clean -xdf; mvn clean install"
41+
# the runall cannot be fullfilled with free plan since it needs more resource to run.
42+
# - docker run -v $TRAVIS_BUILD_DIR:/ws/incubator-mnemonic --rm -t mnemonic/mneci /bin/bash -c "cd /ws/incubator-mnemonic; git log -1 --stat; bin/runall.sh"

bin/runTestCases.py

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
if not os.path.exists(testLogDir):
2828
os.makedirs(testLogDir)
2929

30+
cleanupCmd = r'find mnemonic-* -type f \( -name "*.mne" -o -name "*.dat" \) -exec rm {} \;'
3031
testCmdFile = 'bin/test.conf'
3132
tcCmdReg = re.compile('^mvn\s.*$')
3233
tcNameReg = re.compile('-D(?:test|suites)=(.+?)\s')
@@ -40,6 +41,7 @@
4041
try:
4142
#maven build
4243
subprocess.check_call(match[0] + ">" + logFilePath, stderr=subprocess.STDOUT, shell=True)
44+
subprocess.call(cleanupCmd, stderr=subprocess.STDOUT, shell=True)
4345
print("[SUCCESS] Test case " + tcNameReg.findall(line)[0] + " for \"" + tcModuleReg.findall(line)[0]+ "\" is completed!")
4446
except subprocess.CalledProcessError as e:
4547
print("[ERROR] This test case requires \"pmalloc\" memory service to pass, please check if \"pmalloc\" has been configured correctly! If \"pmalloc\" is installed, please refer to testlog/" + tcNameReg.findall(line)[0] + ".log for detailed information.")

bin/runall.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,26 @@ fi
6161

6262
if [ ! -d "testlog" ]
6363
then
64-
mkdir testlog
64+
mkdir testlog
6565
fi
6666

6767
mvn clean package install > testlog/build.log
6868
if [ $? -gt 0 ]
6969
then
70-
echo [ERROR] Build failed, please check package dependency and refer to testlog/build.log for error messages.
71-
exit 1
70+
echo [ERROR] Build failed, please check package dependency and refer to testlog/build.log for error messages.
71+
exit 1
7272
fi
7373
echo [SUCCESS] Build Success!
7474

7575
echo [INFO] Running mnemonic example...
7676
mvn exec:exec -Pexample -pl mnemonic-examples > testlog/mnemonic-example.log
7777
if [ $? -gt 0 ]
7878
then
79-
echo [ERROR] This example requires \"vmem\" memory service to run, please check if \"vmem\" has been configured correctly! If \"vmem\" is installed, please refer to testlog/mnemonic-example.log for detailed information.
80-
exit 1
79+
echo [ERROR] This example requires \"vmem\" memory service to run, please check if \"vmem\" has been configured correctly! If \"vmem\" is installed, please refer to testlog/mnemonic-example.log for detailed information.
80+
exit 1
8181
fi
8282
echo [SUCCESS] Mnemonic example is completed!
8383

84-
python bin/runTestCases.py
84+
python bin/runTestCases.py || { echo "Test failed"; exit 33; }
8585

8686
popd

0 commit comments

Comments
 (0)