Skip to content

Commit 1b8f5ce

Browse files
committed
Initial commit
1 parent 2fbf2b4 commit 1b8f5ce

File tree

96 files changed

+14243
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+14243
-0
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: amnweb
2+
ko_fi: amnweb

.github/workflows/build.yml

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
name: Build
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
env:
10+
PYTHON_VERSION: '3.14'
11+
12+
jobs:
13+
build:
14+
permissions:
15+
contents: write
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- arch: x64
21+
runner: windows-latest
22+
artifact_name: yasb-gui-x64
23+
- arch: arm64
24+
runner: windows-11-arm
25+
artifact_name: yasb-gui-aarch64
26+
27+
runs-on: ${{ matrix.runner }}
28+
29+
steps:
30+
- name: Checkout Repository
31+
uses: actions/checkout@v6
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v6
35+
with:
36+
python-version: ${{ env.PYTHON_VERSION }}
37+
38+
- name: Create virtual environment
39+
run: python -m venv venv
40+
shell: pwsh
41+
42+
- name: Install dependencies
43+
run: |
44+
.\venv\Scripts\Activate
45+
pip install --upgrade pip
46+
pip install .[build] --no-cache
47+
shell: pwsh
48+
49+
- name: Build EXE
50+
run: |
51+
.\venv\Scripts\Activate
52+
python app/scripts/build.py build
53+
shell: pwsh
54+
55+
- name: Build MSI
56+
run: |
57+
.\venv\Scripts\Activate
58+
python app/scripts/build.py bdist_msi
59+
shell: pwsh
60+
61+
- name: Upload MSI Artifact
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: ${{ matrix.artifact_name }}
65+
path: dist/out/*.msi
66+
67+
release:
68+
needs: build
69+
runs-on: windows-latest
70+
permissions:
71+
contents: write
72+
73+
steps:
74+
- name: Checkout Repository
75+
uses: actions/checkout@v4
76+
with:
77+
fetch-depth: 0
78+
79+
- name: Download all artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
path: dist-msis
83+
pattern: yasb-gui-*
84+
merge-multiple: true
85+
86+
- name: Get version
87+
id: version
88+
run: |
89+
$content = Get-Content -Path "app/core/constants.py" -Raw
90+
$version = [regex]::Match($content, 'APP_VERSION\s*=\s*"([^"]+)"').Groups[1].Value
91+
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
92+
echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
93+
shell: pwsh
94+
95+
- name: Generate Changelog
96+
id: changelog
97+
run: |
98+
$previousTag = git describe --tags --abbrev=0 2>$null
99+
if (-not $previousTag) {
100+
$previousTag = git rev-list --max-parents=0 HEAD
101+
}
102+
103+
$commits = git log "$previousTag..HEAD" --pretty=format:"%h|%s|%an" --no-merges
104+
105+
$repoUrl = "${{ github.server_url }}/${{ github.repository }}"
106+
107+
$features = @()
108+
$fixes = @()
109+
$other = @()
110+
111+
foreach ($commit in $commits -split "`n") {
112+
if (-not $commit) { continue }
113+
$parts = $commit -split '\|'
114+
$hash = $parts[0]
115+
$message = $parts[1]
116+
117+
$entry = "- $message ([$hash]($repoUrl/commit/$hash))"
118+
119+
if ($message -match "^feat|^add|^new") {
120+
$features += $entry
121+
}
122+
elseif ($message -match "^fix|^bug|^patch") {
123+
$fixes += $entry
124+
}
125+
else {
126+
$other += $entry
127+
}
128+
}
129+
130+
$changelog = ""
131+
132+
if ($features.Count -gt 0) {
133+
$changelog += "### ✨ Features`n`n"
134+
$changelog += ($features -join "`n") + "`n`n"
135+
}
136+
137+
if ($fixes.Count -gt 0) {
138+
$changelog += "### 🐛 Bug Fixes`n`n"
139+
$changelog += ($fixes -join "`n") + "`n`n"
140+
}
141+
142+
if ($other.Count -gt 0) {
143+
$changelog += "### 📦 Other Changes`n`n"
144+
$changelog += ($other -join "`n") + "`n`n"
145+
}
146+
147+
if (-not $changelog) {
148+
$changelog = "No significant changes in this release."
149+
}
150+
151+
$changelog | Out-File -FilePath "CHANGELOG_BODY.md" -Encoding utf8
152+
153+
echo "Generated changelog:"
154+
echo $changelog
155+
shell: pwsh
156+
157+
- name: Generate Checksum
158+
run: |
159+
$checksums = Get-FileHash dist-msis/*.msi -Algorithm SHA256
160+
$output = @()
161+
foreach ($checksum in $checksums) {
162+
$filename = [System.IO.Path]::GetFileName($checksum.Path)
163+
$output += "$($checksum.Hash) $filename"
164+
}
165+
$output -join "`n" | Out-File -FilePath "dist-msis/checksums.txt" -Encoding utf8
166+
167+
echo "Checksums:"
168+
Get-Content "dist-msis/checksums.txt"
169+
shell: pwsh
170+
171+
- name: Create Tag
172+
uses: actions/github-script@v7
173+
env:
174+
VERSION: ${{ steps.version.outputs.VERSION }}
175+
with:
176+
script: |
177+
const version = `v${process.env.VERSION}`;
178+
const { owner, repo } = context.repo;
179+
const sha = context.sha;
180+
181+
try {
182+
const { data: tags } = await github.rest.repos.listTags({ owner, repo });
183+
const tagExists = tags.some(tag => tag.name === version);
184+
185+
if (!tagExists) {
186+
console.log(`Creating tag ${version}`);
187+
await github.rest.git.createRef({
188+
owner,
189+
repo,
190+
ref: `refs/tags/${version}`,
191+
sha,
192+
});
193+
} else {
194+
console.log(`Tag ${version} already exists, skipping`);
195+
}
196+
} catch (error) {
197+
console.error(`Error: ${error.message}`);
198+
throw error;
199+
}
200+
201+
- name: Create Release
202+
uses: softprops/action-gh-release@v2
203+
with:
204+
tag_name: v${{ steps.version.outputs.VERSION }}
205+
name: 'YASB GUI v${{ steps.version.outputs.VERSION }} (Beta)'
206+
body_path: CHANGELOG_BODY.md
207+
draft: true
208+
prerelease: false
209+
files: |
210+
dist-msis/*.msi
211+
dist-msis/checksums.txt

.github/workflows/tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: windows-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
test:
14+
- name: Schema Fetcher
15+
file: test_schema_fetcher.py
16+
- name: Code Editor
17+
file: test_code_editor.py
18+
- name: Config Manager
19+
file: test_config_manager.py
20+
- name: Widget Formatting
21+
file: test_widgets.py
22+
- name: Updater
23+
file: test_updater.py
24+
- name: Locales
25+
file: test_locales.py
26+
27+
name: ${{ matrix.test.name }}
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v6
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v6
35+
with:
36+
python-version: '3.14'
37+
cache: 'pip'
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install pytest ruamel.yaml
43+
44+
- name: Fetch widget schemas
45+
if: matrix.test.file == 'test_widgets.py'
46+
run: python tests/fetch_schemas.py
47+
48+
- name: Run tests
49+
run: pytest tests/${{ matrix.test.file }} -v

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
venv/
5+
.venv/
6+
ENV/
7+
env/
8+
.DS_Store
9+
Thumbs.db
10+
desktop.ini
11+
build/
12+
dist/
13+
*.msi
14+
*.exe
15+
*.log

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"charliermarsh.ruff"
4+
]
5+
}

.vscode/settings.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"files.exclude": {
3+
"**/__pycache__": true,
4+
"app/build": true,
5+
},
6+
"search.exclude": {
7+
"**/__pycache__": true,
8+
"app/build": true,
9+
},
10+
"files.watcherExclude": {
11+
"**/__pycache__": true,
12+
"app/build": true,
13+
},
14+
"[python]": {
15+
"editor.formatOnSave": true,
16+
"editor.codeActionsOnSave": {
17+
"source.fixAll": "explicit",
18+
"source.organizeImports": "explicit"
19+
},
20+
"editor.defaultFormatter": "charliermarsh.ruff"
21+
}
22+
}

0 commit comments

Comments
 (0)