Skip to content

Commit 811a07c

Browse files
Build for Linux and MacOS too
1 parent e9fed55 commit 811a07c

File tree

10 files changed

+2801
-337
lines changed

10 files changed

+2801
-337
lines changed

.github/workflows/build-linux.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build Linux
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ main ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install system dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y python3-tk python3-dev
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -r requirements.txt
33+
pip install pyinstaller
34+
35+
- name: Build with PyInstaller
36+
run: |
37+
pyinstaller --name="ChiX" \
38+
--windowed \
39+
--onefile \
40+
--add-data="chix:chix" \
41+
--icon=generated-icon.png \
42+
main.py
43+
44+
- name: Create artifact directory
45+
run: mkdir -p dist/artifacts
46+
47+
- name: Package application
48+
run: |
49+
cd dist
50+
tar -czvf artifacts/ChiX-Linux.tar.gz ChiX
51+
52+
- name: Upload Linux artifact
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: chix-linux
56+
path: dist/artifacts/ChiX-Linux.tar.gz
57+
58+
- name: Release
59+
uses: softprops/action-gh-release@v1
60+
if: startsWith(github.ref, 'refs/tags/')
61+
with:
62+
files: |
63+
dist/artifacts/ChiX-Linux.tar.gz
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/build-macos.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build macOS
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ main ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: macos-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
pip install pyinstaller
29+
30+
- name: Build with PyInstaller
31+
run: |
32+
pyinstaller --name="ChiX" \
33+
--windowed \
34+
--onefile \
35+
--add-data="chix:chix" \
36+
--icon=generated-icon.png \
37+
main.py
38+
39+
- name: Create artifact directory
40+
run: mkdir -p dist/artifacts
41+
42+
- name: Package application
43+
run: |
44+
cd dist
45+
# Create app bundle directory structure
46+
mkdir -p ChiX.app/Contents/MacOS
47+
mkdir -p ChiX.app/Contents/Resources
48+
49+
# Move executable to app bundle
50+
mv ChiX ChiX.app/Contents/MacOS/
51+
52+
# Copy icon and create Info.plist
53+
cp ../generated-icon.png ChiX.app/Contents/Resources/
54+
55+
# Create Info.plist
56+
cat > ChiX.app/Contents/Info.plist << EOF
57+
<?xml version="1.0" encoding="UTF-8"?>
58+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
59+
<plist version="1.0">
60+
<dict>
61+
<key>CFBundleExecutable</key>
62+
<string>ChiX</string>
63+
<key>CFBundleIconFile</key>
64+
<string>generated-icon.png</string>
65+
<key>CFBundleIdentifier</key>
66+
<string>com.prakhardoneria.chix</string>
67+
<key>CFBundleInfoDictionaryVersion</key>
68+
<string>6.0</string>
69+
<key>CFBundleName</key>
70+
<string>ChiX</string>
71+
<key>CFBundlePackageType</key>
72+
<string>APPL</string>
73+
<key>CFBundleShortVersionString</key>
74+
<string>1.0</string>
75+
<key>NSHighResolutionCapable</key>
76+
<true/>
77+
</dict>
78+
</plist>
79+
EOF
80+
81+
# Create DMG
82+
hdiutil create -volname "ChiX" -srcfolder ChiX.app -ov -format UDZO artifacts/ChiX-macOS.dmg
83+
84+
- name: Upload macOS artifact
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: chix-macos
88+
path: dist/artifacts/ChiX-macOS.dmg
89+
90+
- name: Release
91+
uses: softprops/action-gh-release@v1
92+
if: startsWith(github.ref, 'refs/tags/')
93+
with:
94+
files: |
95+
dist/artifacts/ChiX-macOS.dmg
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Windows
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ main ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python 3.10
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.10'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
pip install pyinstaller
29+
30+
- name: Build with PyInstaller
31+
run: |
32+
pyinstaller --name="ChiX" `
33+
--windowed `
34+
--onefile `
35+
--add-data="chix;chix" `
36+
--icon=generated-icon.png `
37+
main.py
38+
shell: pwsh
39+
40+
- name: Create artifact directory
41+
run: mkdir -p dist/artifacts
42+
shell: bash
43+
44+
- name: Package application
45+
run: |
46+
cd dist
47+
powershell Compress-Archive -Path ChiX.exe -DestinationPath artifacts/ChiX-Windows.zip
48+
49+
- name: Upload Windows artifact
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: chix-windows
53+
path: dist/artifacts/ChiX-Windows.zip
54+
55+
- name: Release
56+
uses: softprops/action-gh-release@v1
57+
if: startsWith(github.ref, 'refs/tags/')
58+
with:
59+
files: |
60+
dist/artifacts/ChiX-Windows.zip
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Python 3.10
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -r requirements.txt
26+
pip install flake8 pytest
27+
28+
- name: Lint with flake8
29+
run: |
30+
# stop the build if there are Python syntax errors or undefined names
31+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
32+
# exit-zero treats all errors as warnings
33+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34+
35+
build-matrix:
36+
needs: test
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
os: [ubuntu-latest, macos-latest, windows-latest]
41+
include:
42+
- os: ubuntu-latest
43+
artifact_name: ChiX-Linux.tar.gz
44+
asset_name: chix-linux
45+
- os: macos-latest
46+
artifact_name: ChiX-macOS.dmg
47+
asset_name: chix-macos
48+
- os: windows-latest
49+
artifact_name: ChiX-Windows.zip
50+
asset_name: chix-windows
51+
52+
runs-on: ${{ matrix.os }}
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
57+
- name: Set up Python 3.10
58+
uses: actions/setup-python@v4
59+
with:
60+
python-version: '3.10'
61+
62+
- name: Install system dependencies (Linux only)
63+
if: matrix.os == 'ubuntu-latest'
64+
run: |
65+
sudo apt-get update
66+
sudo apt-get install -y python3-tk python3-dev
67+
68+
- name: Install dependencies
69+
run: |
70+
python -m pip install --upgrade pip
71+
pip install -r requirements.txt
72+
pip install pyinstaller
73+
74+
- name: Build with PyInstaller (Linux/macOS)
75+
if: matrix.os != 'windows-latest'
76+
run: |
77+
pyinstaller --name="ChiX" \
78+
--windowed \
79+
--onefile \
80+
--add-data="chix:chix" \
81+
--icon=generated-icon.png \
82+
main.py
83+
84+
- name: Build with PyInstaller (Windows)
85+
if: matrix.os == 'windows-latest'
86+
shell: pwsh
87+
run: |
88+
pyinstaller --name="ChiX" `
89+
--windowed `
90+
--onefile `
91+
--add-data="chix;chix" `
92+
--icon=generated-icon.png `
93+
main.py
94+
95+
- name: Create artifact directory
96+
run: mkdir -p dist/artifacts
97+
shell: bash
98+
99+
- name: Package application (Linux)
100+
if: matrix.os == 'ubuntu-latest'
101+
run: |
102+
cd dist
103+
tar -czvf artifacts/ChiX-Linux.tar.gz ChiX
104+
105+
- name: Package application (macOS)
106+
if: matrix.os == 'macos-latest'
107+
run: |
108+
cd dist
109+
mkdir -p ChiX.app/Contents/MacOS
110+
mkdir -p ChiX.app/Contents/Resources
111+
mv ChiX ChiX.app/Contents/MacOS/
112+
cp ../generated-icon.png ChiX.app/Contents/Resources/
113+
114+
# Create Info.plist
115+
cat > ChiX.app/Contents/Info.plist << EOF
116+
<?xml version="1.0" encoding="UTF-8"?>
117+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
118+
<plist version="1.0">
119+
<dict>
120+
<key>CFBundleExecutable</key>
121+
<string>ChiX</string>
122+
<key>CFBundleIconFile</key>
123+
<string>generated-icon.png</string>
124+
<key>CFBundleIdentifier</key>
125+
<string>com.prakhardoneria.chix</string>
126+
<key>CFBundleInfoDictionaryVersion</key>
127+
<string>6.0</string>
128+
<key>CFBundleName</key>
129+
<string>ChiX</string>
130+
<key>CFBundlePackageType</key>
131+
<string>APPL</string>
132+
<key>CFBundleShortVersionString</key>
133+
<string>1.0</string>
134+
<key>NSHighResolutionCapable</key>
135+
<true/>
136+
</dict>
137+
</plist>
138+
EOF
139+
140+
# Create DMG
141+
hdiutil create -volname "ChiX" -srcfolder ChiX.app -ov -format UDZO artifacts/ChiX-macOS.dmg
142+
143+
- name: Package application (Windows)
144+
if: matrix.os == 'windows-latest'
145+
run: |
146+
cd dist
147+
powershell Compress-Archive -Path ChiX.exe -DestinationPath artifacts/ChiX-Windows.zip
148+
149+
- name: Upload artifact
150+
uses: actions/upload-artifact@v3
151+
with:
152+
name: ${{ matrix.asset_name }}
153+
path: dist/artifacts/${{ matrix.artifact_name }}

0 commit comments

Comments
 (0)