Add Github action for OSX build (#332)

This commit is contained in:
Sander Land authored and GitHub committed 2021-01-23 15:08:24 +01:00
1 parent 0bf25c1fc5
commit c6af552dbd
6 files changed
+88 -6

No files matched your search

+70
View File
@@ -0,0 +1,70 @@
name: build_osx
on:
push:
branches: [ master ]
jobs:
osx_app:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Build KataGo
run: |
rm katrain/KataGo/katago
rm katrain/KataGo/*.dll
rm katrain/KataGo/katago.exe
cd ..
git clone https://github.com/lightvector/KataGo.git
pushd KataGo/cpp
cmake . -DUSE_BACKEND=OPENCL
make
cp katago ../../katrain/katrain/KataGo/katago-osx
- name: Get Kivy dependencies
run: |
cd ..
git clone https://github.com/kivy/kivy-sdk-packager.git
cd kivy-sdk-packager/osx
curl -O -L https://kivy.org/downloads/ci/osx/app/Kivy.dmg
hdiutil attach Kivy.dmg -mountroot .
cp -R Kivy/Kivy.app KaTrain.app
- name: Install KaTrain pip dependencies
run: |
pushd ../kivy-sdk-packager/osx/KaTrain.app/Contents/Resources/venv/bin
source activate
popd
python -m pip install .
- name: Finalize KaTrain bundle
run: |
cd ../kivy-sdk-packager/osx
pushd KaTrain.app/Contents/Resources/
ln -s ./venv/bin/KaTrain yourapp
popd
./fix-bundle-metadata.sh KaTrain.app -n KaTrain -v "1.7.2" -a "Sander Land" -o "org.katrain.KaTrain" -i "../../katrain/katrain/img/icon.ico"
./cleanup-app.sh KaTrain.app -g 1
./relocate.sh KaTrain.app
- name: Create dmg
run: |
pushd ../kivy-sdk-packager/osx
./create-osx-dmg.sh KaTrain.app KaTrain
popd
mkdir osx_app
cp ../kivy-sdk-packager/osx/KaTrain.dmg osx_app/
- name: Upload app as artifact
uses: actions/upload-artifact@v2
with:
name: KaTrainOSX
path: osx_app
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: KaTrainOSX/*
draft: true
fail_on_unmatched_files: true
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
+10
View File
@@ -10,6 +10,10 @@
## <img src="https://upload.wikimedia.org/wikipedia/commons/8/8a/Apple_Logo.svg" alt="MacOs" height="35"/> Installation for MacOS users
### <a name="MacQuick"></a>Quick install guide
You can find downloadable .app files for MacOSX [here](https://github.com/sanderland/katrain/releases).
Simply download, unzip the file, mount the .dmg and drag the .app file to your application folder, everything is included.
### <a name="MacCommand"></a>Command line install guide
[Open a terminal](https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac) and enter the following commands:
```bash
@@ -18,6 +22,7 @@ brew install python3
brew install katago
pip3 install katrain
```
Now you can start KaTrain by simply typing `katrain` in a terminal.
These commands install [Homebrew](https://brew.sh), which simplifies installing packages,
@@ -34,6 +39,11 @@ Installation from sources is essentially the same as for Linux, see [here](#Linu
If you encounter SSL errors on downloading model files, you may need to follow [these](https://stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate) instructions to fix your certificates.
Users with the new M1 macs likely need to install the latest unreleased version of kivy using:
```bash
pip3 install "kivy[base] @ https://github.com/kivy/kivy/archive/master.zip"
```
## <img src="https://upload.wikimedia.org/wikipedia/commons/5/5f/Windows_logo_-_2012.svg" alt="Windows" height="35"/> Installation for Windows users
### <a name="WindowsQuick"></a>Quick install guide
+1 -2
View File
@@ -196,7 +196,7 @@ In addition to shortcuts mentioned above and those shown in the main menu:
## <a name="faq"></a> FAQ
* How can I create themes?
* How can I create or install themes?
* See [these instructions](THEMES.md).
* The program is running too slowly. How can I speed it up?
* Adjust the number of visits or maximum time allowed in the settings.
@@ -215,7 +215,6 @@ In addition to shortcuts mentioned above and those shown in the main menu:
* Ideas, feedback, and contributions to code or translations are all very welcome.
* For suggestions and planned improvements, see [open issues](http://github.com/sanderland/katrain/issues) on github to check if the functionality is already planned.
* I am looking for contributors of more translations of both this manual and the program itself. The best way to help with this is to contact me on discord.
* You can contact me on the [Leela Zero & Friends Discord](http://discord.gg/AjTPFpN) (use the #gui channel) to get help, discuss improvements, or simply show your appreciation.
* You can also donate to the project through [Github Sponsors](http://github.com/sponsors/sanderland).
+5 -2
View File
@@ -1,6 +1,7 @@
import copy
import json
import os
import sys
import queue
import shlex
import subprocess
@@ -63,8 +64,10 @@ class KataGoEngine:
exe = "katrain/KataGo/katago.exe"
elif platform == "linux":
exe = "katrain/KataGo/katago"
else: # e.g. MacOS after brewing
exe = "katago"
else:
exe = find_package_resource("katrain/KataGo/katago-osx") # github actions built
if not os.path.isfile(exe):
exe = "katago" # e.g. MacOS after brewing
model = find_package_resource(config["model"])
cfg = find_package_resource(config["config"])
+1 -1
View File
@@ -5,7 +5,7 @@ import subprocess
block_cipher = None
# pyinstaller spec/katrain.spec --noconfirm
# pyinstaller spec/KaTrain.spec --noconfirm
# --upx-dir my
a = Analysis(