Skip to content

Commit 2e84cc0

Browse files
committed
feature: add ci for inceptio branch
1 parent 97973c0 commit 2e84cc0

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.travis.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
language: python
2+
jobs:
3+
include:
4+
- name: "Python 3.8.0 on Bionic Beaver Linux"
5+
dist: bionic
6+
python: 3.8 # this works for Linux but is ignored on macOS or Windows
7+
- name: "Python 3.7.4 on macOS"
8+
os: osx
9+
osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4
10+
language: shell # 'language: python' is an error on Travis CI macOS
11+
- name: "Python 3.8.0 on Windows"
12+
os: windows # Windows 10.0.17134 N/A Build 17134
13+
language: shell # 'language: python' is an error on Travis CI Windows
14+
before_install:
15+
- choco install python --version 3.8.0
16+
- python -m pip install --upgrade pip
17+
env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
18+
branches:
19+
only:
20+
- inceptio
21+
22+
install:
23+
- pip3 install --upgrade pip # all three OSes agree about 'pip3'
24+
- pip3 install -r requirements.txt
25+
- pip3 install pyinstaller
26+
27+
script:
28+
- pyinstaller build.spec
29+
- if [[ ${TRAVIS_OS_NAME} == "windows" ]]; then
30+
python ./tools/ci_notify.py;
31+
else
32+
python3 ./tools/ci_notify.py;
33+
fi

tools/ci_notify.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import os
2+
import platform
3+
import smtplib
4+
import sys
5+
from email.mime.text import MIMEText
6+
from email.mime.multipart import MIMEMultipart
7+
from email.header import Header
8+
9+
try:
10+
from aceinna import VERSION
11+
except: # pylint: disable=bare-except
12+
sys.path.append('./src')
13+
from aceinna import VERSION
14+
15+
SYS = platform.system()
16+
SENDER = os.environ['EMAIL_ADDRESS']
17+
RECEIVERS = ['[email protected]']
18+
PASSWORD = os.environ['EMAIL_PASSWORD']
19+
20+
MESSAGE = MIMEMultipart()
21+
MESSAGE['From'] = Header("[email protected]", 'utf-8')
22+
MESSAGE['To'] = ";".join(RECEIVERS)
23+
SUBJECT = '[{0}] CI Executable'.format(SYS)
24+
MESSAGE['Subject'] = Header(SUBJECT, 'utf-8')
25+
26+
MESSAGE.attach(
27+
MIMEText('<p>[Inceptio Branch] Built executable on {0}</p><p>Version: {1}</p>'.format(SYS, VERSION), 'html', 'utf-8'))
28+
29+
FILE_NAME = 'ans-devices.exe' if SYS == "Windows" else 'ans-devices'
30+
31+
ATTACHMENT = MIMEText(open(os.path.join(os.getcwd(), 'dist', FILE_NAME),
32+
'rb').read(), 'base64', 'utf-8')
33+
ATTACHMENT["Content-Type"] = 'application/octet-stream'
34+
ATTACHMENT["Content-Disposition"] = 'attachment; filename="{0}"'.format(
35+
FILE_NAME)
36+
MESSAGE.attach(ATTACHMENT)
37+
38+
try:
39+
smtp_client = smtplib.SMTP('smtp.office365.com', 587)
40+
smtp_client.ehlo()
41+
smtp_client.starttls()
42+
smtp_client.login(SENDER, PASSWORD)
43+
smtp_client.sendmail(SENDER, RECEIVERS, MESSAGE.as_string())
44+
except smtplib.SMTPException as error:
45+
print(error)

0 commit comments

Comments
 (0)