Debian Codegraph @

docs/software_dev/build.rst

raw
1 .. _build_app:
2
3 Building buskill-app
4 ====================
5
6 This section documents how to build the BusKill App.
7
8 .. note::
9
10 Our build scripts are designed to be run on GitHub's shared runners -- disposable cloud instances. Therefore, our build scripts may make system-wide package changes and they may not cleanup at the end of their execution.
11
12 We recommend that you execute these on a fresh disposable VM and take a snapshot before proceeding.
13
14 Linux
15 -----
16
17 Our build script is executed on GitHub's shared runners, which use Ubuntu. For better reproducibility, the build script itself is executed inside a wrapper script that installs and executes the build script in a debian docker container. For more information, see:
18
19 #. The `list of Ubuntu versions in GitHub's documentation <https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources>`_
20 #. Our `build logs <https://github.com/BusKill/buskill-app/actions?query=workflow%3Abuild>`_
21
22 ::
23
24 sudo su -
25 sudo apt-get install git
26 git clone https://github.com/BusKill/buskill-app.git
27 cd buskill-app/
28 build/linux/debianWrapper.sh
29
30 .. note::
31
32 When first setting up your build environment, it may be helpful to reference our `GitHub build workflow for Linux <https://github.com/BusKill/buskill-app/blob/master/.github/workflows/build.yml#L12-L22>`_.
33
34 After you've successfully built the app once, you can iterate more quickly by using the python binary used to build the AppImage to execute the ``src/main.py`` script directly. Call it with no arguments to execute it in GUI mode. If you add arguments, it will execute in CLI mode. For example
35
36 ::
37
38 user@buskill:~/sandbox/buskill-app$ /tmp/kivy_appdir/opt/python*/bin/python* src/main.py --help
39 buskill version {'VERSION': '', 'GITHUB_REF': '', 'GITHUB_SHA': '', 'SOURCE_DATE_EPOCH': ''}
40 usage: buskill [-h] [--version] [-v] [-a] [-l] [-U]
41
42 App for arming and configuring BusKill. For help, see https://docs.buskill.in
43
44 optional arguments:
45 -h, --help show this help message and exit
46 --version print version and exit.
47 -v, --verbose increase output verbosity
48 -a, --arm Arms BusKill
49 -U, --upgrade Download & upgrade latest version of BusKill
50 user@buskill:~/sandbox/buskill-app$
51
52 Windows
53 -------
54
55 Our build script is executed on GitHub's shared runners. For more information on the specific version of Windows you should use for best results, see:
56
57 #. The `list of Windows versions in GitHub's documentation <https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources>`_
58 #. Our `build logs <https://github.com/BusKill/buskill-app/actions?query=workflow%3Abuild>`_
59
60 .. note::
61
62 When first setting up your build environment, it may be helpful to reference our `GitHub build workflow for Windows <https://github.com/BusKill/buskill-app/blob/master/.github/workflows/build.yml#L68-L73>`_.
63
64 ::
65
66 git clone https://github.com/BusKill/buskill-app.git
67 cd buskill-app/
68 build/windows/buildExe.ps1
69
70 .. note::
71
72 Run the ``build\windows\buildExe.ps1`` script from inside a powershell.
73
74 If you get Permission Denied issues, open a new PowerShell as root (Open as Administrator), and enter the following commands
75
76 Set-ExecutionPolicy Unrestricted
77 Set-ExecutionPolicy -Scope CurrentUser Unrestricted
78
79 And in general, we recommend using cygwin when building on Windows.
80
81 MacOS
82 -----
83
84 Our build script is executed on GitHub's shared runners. For more information on the specific version of MacOS you should use for best results, see:
85
86 #. The `list of MacOS versions in GitHub's documentation <https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources>`_
87 #. Our `build logs <https://github.com/BusKill/buskill-app/actions?query=workflow%3Abuild>`_
88
89 ::
90
91 sudo su -
92 git clone https://github.com/BusKill/buskill-app.git
93 cd buskill-app/
94 build/mac/buildDmg.sh
95
96 .. note::
97
98 When first setting up your build environment, it may be helpful to reference our `GitHub build workflow for MacOS <https://github.com/BusKill/buskill-app/blob/master/.github/workflows/build.yml#L118-L127>`_.
99
100 After you've successfully built the app once, you can iterate more quickly by using the python binary that was used to build the MacOS release with PyInstaller to execute the ``src/main.py`` script directly. Call it with no arguments to execute it in GUI mode. If you add arguments, it will execute in CLI mode. For example
101
102 ::
103
104 user@host buskill-app % bash
105
106 The default interactive shell is now zsh.
107 To update your account to use zsh, please run `chsh -s /bin/zsh`.
108 For more details, please visit https://support.apple.com/kb/HT208050.
109 bash-3.2$
110
111 bash-3.2$ cd sandbox/buskill-app
112 bash-3.2$ grep 'PYTHON_PATH=' build/mac/buildDmg.sh | head -n1
113 PYTHON_PATH="`find /usr/local/Cellar/python* -type f -wholename *bin/python3* | sort -n | uniq | head -n1`"
114 bash-3.2$ PYTHON_PATH="`find /usr/local/Cellar/python* -type f -wholename *bin/python3* | sort -n | uniq | head -n1`"
115 bash-3.2$
116
117 bash-3.2$ $PYTHON_PATH src/main.py --help
118 ===============================================================================
119 INFO: Writing to log file '/var/folders/kx/2fp3kfgj4dj7rx9s5mlb52640000gp/T/buskill.log'
120 buskill version {'VERSION': '', 'GITHUB_REF': '', 'GITHUB_SHA': '', 'SOURCE_DATE_EPOCH': ''}
121 usb1.__version__:|1.8|
122 usage: buskill [-h] [--version] [--list-triggers] [-v] [-t] [-T] [-a] [-U]
123
124 App for arming and configuring BusKill. For help, see https://docs.buskill.in
125
126 optional arguments:
127 -h, --help show this help message and exit
128 --version print version and exit.
129 --list-triggers List all available triggers.
130 -v, --verbose increase output verbosity
131 -t , --trigger Choose trigger to execute. See --list-triggers for all
132 possible values.
133 -T, --run-trigger Immediately execute the trigger on start
134 -a, --arm Arms BusKill
135 -U, --upgrade Download & upgrade latest version of BusKill
136 bash-3.2$
137
138 And (also after you've already successfully built the app once), you can iterate faster yet still build the ``.app`` dir with compiled binaries by executing PyInstaller directly. For example.
139
140 ::
141
142 user@host ~ % bash
143
144 The default interactive shell is now zsh.
145 To update your account to use zsh, please run `chsh -s /bin/zsh`.
146 For more details, please visit https://support.apple.com/kb/HT208050.
147 bash-3.2$ cd sandbox/buskill-app/pyinstaller/
148 bash-3.2$
149
150 bash-3.2$ grep 'PYTHON_PATH=' ../build/mac/buildDmg.sh | head -n1
151 PYTHON_PATH="`find /usr/local/Cellar/python* -type f -wholename *bin/python3* | sort -n | uniq | head -n1`"
152 bash-3.2$ PYTHON_PATH="`find /usr/local/Cellar/python* -type f -wholename *bin/python3* | sort -n | uniq | head -n1`"
153 bash-3.2$
154
155 bash-3.2$ $PYTHON_PATH -m PyInstaller -y --clean --windowed buskill.spec
156 ...
157 34250 INFO: Building BUNDLE BUNDLE-00.toc completed successfully.
158 bash-3.2$
159
160 bash-3.2$ dist/buskill-dev.app/Contents/MacOS/buskill --help
161 ===============================================================================
162 INFO: Writing to log file '/var/folders/kx/2fp3kfgj4dj7rx9s5mlb52640000gp/T/buskill.log'
163 buskill version {'VERSION': '', 'GITHUB_REF': '', 'GITHUB_SHA': '', 'SOURCE_DATE_EPOCH': ''}
164 usb1.__version__:|1.8|
165 usage: buskill [-h] [--version] [--list-triggers] [-v] [-t] [-T] [-a] [-U]
166
167 App for arming and configuring BusKill. For help, see https://docs.buskill.in
168
169 optional arguments:
170 -h, --help show this help message and exit
171 --version print version and exit.
172 --list-triggers List all available triggers.
173 -v, --verbose increase output verbosity
174 -t , --trigger Choose trigger to execute. See --list-triggers for all
175 possible values.
176 -T, --run-trigger Immediately execute the trigger on start
177 -a, --arm Arms BusKill
178 -U, --upgrade Download & upgrade latest version of BusKill
179 bash-3.2$