Skip to content

Commit 2e85631

Browse files
committed
Add MacOS Build GIthub Action
1 parent e5279e8 commit 2e85631

4 files changed

Lines changed: 128 additions & 54 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test Build on macOS
2+
on:
3+
pull_request:
4+
branches: [master, development]
5+
push:
6+
branches: [master, development]
7+
8+
jobs:
9+
check:
10+
name: Build GUI on macOS
11+
runs-on: macos-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Setup Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.9'
21+
cache: 'pip' # caching pip dependencies
22+
23+
- name: Install Python Dependencies
24+
run: pip install -r release_script/requirements.txt
25+
26+
- name: Download and Unzip Processing
27+
run: |
28+
curl -O -L --insecure https://github.com/processing/processing4/releases/download/processing-1292-4.2/processing-4.2-macos-x64.zip
29+
unzip processing-4.2-macos-x64.zip
30+
ls
31+
32+
- name: Move Processing.app to Applications
33+
run: |
34+
mv Processing.app /Applications/Processing.app
35+
36+
- name: Add Processing to PATH
37+
run: |
38+
echo "$GITHUB_WORKSPACE/release_script/mac_only/" >> $GITHUB_PATH
39+
chmod +x $GITHUB_WORKSPACE/release_script/mac_only/processing-java
40+
41+
- name: Check PATH
42+
run: echo $PATH
43+
44+
- name: Check GITHUB PATH
45+
run: echo $GITHUB_PATH
46+
47+
- name: Test processing-java command
48+
run: |
49+
processing-java --help
50+
51+
- name: Copy libraries to Processing
52+
run: |
53+
mkdir -p $HOME/Documents/Processing/libraries/
54+
cp -a $GITHUB_WORKSPACE/OpenBCI_GUI/libraries/. $HOME/Documents/Processing/libraries/
55+
56+
- name: Run Unit Tests
57+
run: |
58+
ls
59+
python $GITHUB_WORKSPACE/OpenBCI_GUI_UnitTests/run-unittests.py
60+
61+
- name: Build GUI
62+
run: |
63+
mkdir $GITHUB_WORKSPACE/temp
64+
touch temp/timestamp.txt
65+
touch temp/versionstring.txt
66+
python $GITHUB_WORKSPACE/release_script/make-release.py --no-prompts
67+
GUI_COMMIT_TIME=`cat temp/timestamp.txt`
68+
GUI_VERSION_STRING=`cat temp/versionstring.txt`

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ jobs:
66
python: 3.7.4 # this works for Linux but is ignored on macOS or Windows
77
- name: "Python 3.7.4 on macOS"
88
os: osx
9-
osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.6
9+
osx_image: xcode12.2 # Python 3.7.4 running on macOS 10.14.6
1010
language: shell # 'language: python' is an error on Travis CI macOS
1111

1212
branches:
1313
only:
14-
- master
15-
- development
14+
#- master
15+
#- development
1616

1717
before_install:
1818
- if [ "$TRAVIS_OS_NAME" = osx ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then openssl aes-256-cbc -K $encrypted_2f5d2771e3cb_key -iv $encrypted_2f5d2771e3cb_iv -in release_script/mac_only/Certificates.p12.enc -out release_script/mac_only/Certificates.p12 -d; fi
Lines changed: 52 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
1-
import shutil
2-
import subprocess
3-
import os
4-
import traceback
5-
6-
# add files here that need to be copied to the unit testing sketch
7-
# Question: Why not copy all PDE files?
8-
# Answer: Some PDE files depend on globals declared in OpenBCI_GUI.pde
9-
# and we do not copy OpenBCI_GUI.pde because it delcares a setup()
10-
# function which conflicts with the unit test sketch
11-
# Once we get rid of globals we could copy all PDEs
12-
files_to_unittest = [
13-
"PacketLossTracker.pde",
14-
"TimeTrackingQueue.pde"
15-
]
16-
17-
def main ():
18-
origin_path = "OpenBCI_GUI"
19-
sketch_dir = "OpenBCI_GUI_UnitTests"
20-
21-
# copy any necessary files
22-
for filename in os.listdir(origin_path):
23-
if filename in files_to_unittest:
24-
orig = os.path.join(origin_path, filename)
25-
dest = os.path.join(sketch_dir, filename)
26-
shutil.copy(orig, dest)
27-
28-
try:
29-
# run the unit testing sketch
30-
cwd = os.getcwd()
31-
sketch_dir = os.path.join(cwd, sketch_dir)
32-
subprocess.check_call(["processing-java", "--sketch=" + sketch_dir, "--run"])
33-
except Exception as e:
34-
print(e)
35-
delete_files(sketch_dir)
36-
exit(1) # create CI failure
37-
38-
delete_files(sketch_dir)
39-
40-
fail_file = os.path.join(sketch_dir, "UNITTEST_FAILURE")
41-
if os.path.exists(fail_file):
42-
exit(1) # create CI failure
43-
44-
45-
def delete_files(sketch_dir):
46-
# delete files copied above
47-
for filename in files_to_unittest:
48-
filepath = os.path.join(sketch_dir, filename)
49-
os.remove(filepath)
50-
51-
if __name__ == "__main__":
1+
import shutil
2+
import subprocess
3+
import os
4+
import platform
5+
import traceback
6+
7+
# add files here that need to be copied to the unit testing sketch
8+
# Question: Why not copy all PDE files?
9+
# Answer: Some PDE files depend on globals declared in OpenBCI_GUI.pde
10+
# and we do not copy OpenBCI_GUI.pde because it delcares a setup()
11+
# function which conflicts with the unit test sketch
12+
# Once we get rid of globals we could copy all PDEs
13+
files_to_unittest = [
14+
"PacketLossTracker.pde",
15+
"TimeTrackingQueue.pde"
16+
]
17+
18+
def main ():
19+
origin_path = "OpenBCI_GUI"
20+
sketch_dir = "OpenBCI_GUI_UnitTests"
21+
22+
# copy any necessary files
23+
for filename in os.listdir(origin_path):
24+
if filename in files_to_unittest:
25+
orig = os.path.join(origin_path, filename)
26+
dest = os.path.join(sketch_dir, filename)
27+
shutil.copy(orig, dest)
28+
29+
try:
30+
# run the unit testing sketch
31+
cwd = os.getcwd()
32+
sketch_dir = os.path.join(cwd, sketch_dir)
33+
subprocess.check_call(["processing-java", "--sketch=" + sketch_dir, "--run"])
34+
except Exception as e:
35+
print(e)
36+
delete_files(sketch_dir)
37+
exit(1) # create CI failure
38+
39+
delete_files(sketch_dir)
40+
41+
fail_file = os.path.join(sketch_dir, "UNITTEST_FAILURE")
42+
if os.path.exists(fail_file):
43+
exit(1) # create CI failure
44+
45+
46+
def delete_files(sketch_dir):
47+
# delete files copied above
48+
for filename in files_to_unittest:
49+
filepath = os.path.join(sketch_dir, filename)
50+
os.remove(filepath)
51+
52+
if __name__ == "__main__":
5253
main ()

release_script/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
requests
2+
beautifulsoup4
3+
awscli
4+
dmgbuild
5+
biplist

0 commit comments

Comments
 (0)