Skip to content

Commit 6e38d34

Browse files
committed
refactor(workflows): streamline package installation in CI scripts
- Updated package installation commands to use the new 'packaging' extras. - Removed conditional installation of cx-Freeze stable version for cleaner workflow. - Enhanced the winget workflow to include ARM64 architecture support.
1 parent 07bc858 commit 6e38d34

File tree

8 files changed

+19
-22
lines changed

8 files changed

+19
-22
lines changed

.github/workflows/pr-check.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ jobs:
170170
run: |
171171
.\venv\Scripts\Activate
172172
python -m pip install --upgrade pip
173-
pip install --force --no-cache .
174-
pip install git+https://github.com/amnweb/cx_Freeze.git@fix/msi-product-name
175-
pip install git+https://github.com/amnweb/python-msilib --force --no-cache
173+
pip install --force --no-cache .[packaging]
176174
shell: pwsh
177175

178176
- name: Build Installer
@@ -241,9 +239,7 @@ jobs:
241239
run: |
242240
.\venv\Scripts\Activate
243241
python -m pip install --upgrade pip
244-
pip install --force --no-cache .
245-
pip install git+https://github.com/amnweb/cx_Freeze.git@fix/msi-product-name
246-
pip install git+https://github.com/amnweb/python-msilib --force --no-cache
242+
pip install --force --no-cache .[packaging]
247243
shell: pwsh
248244

249245
- name: Build EXE

.github/workflows/windows-dev.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,12 @@ jobs:
8585
run: |
8686
.\venv\Scripts\Activate
8787
python -m pip install --upgrade pip
88-
pip install --force --no-cache .
88+
pip install --force --no-cache .[packaging]
8989
$cxFreezeVersion = "${{ github.event.inputs.cx_freeze_version }}"
9090
if ($cxFreezeVersion -eq "dev") {
9191
Write-Host "Installing cx_Freeze dev version from GitHub"
9292
pip install git+https://github.com/amnweb/cx_Freeze.git@fix/msi-product-name
9393
pip install git+https://github.com/amnweb/python-msilib --force --no-cache
94-
} else {
95-
Write-Host "Installing cx_Freeze stable version"
96-
pip install --force --no-cache --upgrade cx_Freeze
9794
}
9895
shell: pwsh
9996

.github/workflows/windows.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,12 @@ jobs:
6161
run: |
6262
.\venv\Scripts\Activate
6363
python -m pip install --upgrade pip
64-
pip install --force --no-cache .
64+
pip install --force --no-cache .[packaging]
6565
if ("${{ github.event.inputs.cx_freeze_version }}" -eq "dev") {
6666
Write-Host "Installing cx_Freeze dev version from GitHub"
6767
pip install git+https://github.com/amnweb/cx_Freeze.git@fix/msi-product-name
6868
pip install git+https://github.com/amnweb/python-msilib --force --no-cache
69-
} else {
70-
Write-Host "Installing cx_Freeze stable version"
71-
pip install --force --no-cache --upgrade cx_Freeze
72-
}
69+
}
7370
shell: pwsh
7471

7572
- name: Build EXE

.github/workflows/winget.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ jobs:
2626
# Get both x64 and aarch64 MSI URLs
2727
$assets = $targetRelease | Select-Object -ExpandProperty assets
2828
$x64Url = $assets | Where-Object -Property name -match 'x64\.msi$' | Select-Object -ExpandProperty browser_download_url
29-
# Temporarily disabled ARM64
30-
# $aarch64Url = $assets | Where-Object -Property name -match 'aarch64\.msi$' | Select-Object -ExpandProperty browser_download_url
29+
$aarch64Url = $assets | Where-Object -Property name -match 'aarch64\.msi$' | Select-Object -ExpandProperty browser_download_url
3130
3231
$relaseTitle = "New version: AmN.yasb version $packageVersion"
3332
$relaseUrl = $targetRelease.html_url
3433
$relaseDate = [datetime]::Parse($targetRelease.published_at).ToString("yyyy-MM-dd")
3534
3635
# Update package using wingetcreate with both architectures
3736
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
38-
# Temporarily submitting only x64
3937
.\wingetcreate.exe update $packageId --version $packageVersion --urls "$x64Url|x64" --prtitle "$relaseTitle" --release-notes-url "$relaseUrl" --release-date "$relaseDate" --submit --token $gitToken
40-
# .\wingetcreate.exe update $packageId --version $packageVersion --urls "$x64Url|x64" "$aarch64Url|arm64" --prtitle "$relaseTitle" --release-notes-url "$relaseUrl" --release-date "$relaseDate" --submit --token $gitToken
38+
.\wingetcreate.exe update $packageId --version $packageVersion --urls "$x64Url|x64" "$aarch64Url|arm64" --prtitle "$relaseTitle" --release-notes-url "$relaseUrl" --release-date "$relaseDate" --submit --token $gitToken

docs/widgets/(Widget)-GPU.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ If you see a table with your GPU information, `nvidia-smi` is available. If you
2929
| `label_shadow` | dict | `{"enabled": False, "color": "black", "offset": [1, 1], "radius": 3}` | Label shadow options. |
3030
| `progress_bar` | dict | `{'enabled': false, 'position': 'left', 'size': 14, 'thickness': 2, 'color': '#57948a', 'animation': false}` | Progress bar settings. |
3131
| `hide_decimal` | bool | `false` | Whether to hide decimal places in the GPU widget. |
32+
| `units` | string | `"metric"` | Whether the temperature is converted to Fahrenheit (if set to `"imperial"`) or Celsius (if not set or explicitly set to `"metric"`) |
3233

3334
> **About `index`:** If you have multiple NVIDIA GPUs, you can set the `gpu_index` option to select which GPU to monitor. Create multiple GPU widgets with different `gpu_index` values (e.g., 0, 1, 2, ...) to display stats for each card separately.
3435

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ dev = [
6262
"pyqt6-stubs",
6363
"types-pillow",
6464
]
65-
65+
packaging = [
66+
"cx-Freeze==8.5.0",
67+
"python-msilib @ git+https://github.com/amnweb/python-msilib.git"
68+
]
6669
[tool.hatch.metadata]
6770
allow-direct-references = true
6871

src/core/validation/widgets/yasb/gpu.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"callbacks": {"on_left": "toggle_label", "on_middle": "do_nothing", "on_right": "do_nothing"},
1212
"gpu_thresholds": {"low": 30, "medium": 60, "high": 90},
1313
"hide_decimal": False,
14+
"units": "metric",
1415
}
1516

1617
VALIDATION_SCHEMA = {
@@ -124,4 +125,5 @@
124125
"default": DEFAULTS["gpu_thresholds"],
125126
},
126127
"hide_decimal": {"type": "boolean", "default": DEFAULTS["hide_decimal"]},
128+
"units": {"type": "string", "default": DEFAULTS["units"], "allowed": ["metric", "imperial"]},
127129
}

src/core/widgets/yasb/gpu.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(
3636
container_padding: dict[str, int],
3737
callbacks: dict[str, str],
3838
gpu_thresholds: dict[str, int],
39+
units: str,
3940
label_shadow: dict = None,
4041
container_shadow: dict = None,
4142
progress_bar: dict = None,
@@ -54,6 +55,7 @@ def __init__(
5455
self._label_shadow = label_shadow
5556
self._container_shadow = container_shadow
5657
self._gpu_thresholds = gpu_thresholds
58+
self._units = units
5759
self._progress_bar = progress_bar
5860
self._hide_decimal = hide_decimal
5961

@@ -173,15 +175,16 @@ def _update_label(self, gpu_data):
173175
"""Update the label with GPU data."""
174176
self._gpu_util_history.append(gpu_data.utilization)
175177
self._gpu_mem_history.append(gpu_data.mem_used)
176-
178+
_temp = gpu_data.temp if self._units == "metric" else (gpu_data.temp * (9 / 5) + 32)
179+
_temp = round(_temp) if self._hide_decimal else _temp
177180
_naturalsize = lambda value: naturalsize(value, True, True, "%.0f" if self._hide_decimal else "%.1f")
178181
gpu_info = {
179182
"index": gpu_data.index,
180183
"utilization": gpu_data.utilization,
181184
"mem_total": _naturalsize(gpu_data.mem_total * 1024 * 1024),
182185
"mem_used": _naturalsize(gpu_data.mem_used * 1024 * 1024),
183186
"mem_free": _naturalsize(gpu_data.mem_free * 1024 * 1024),
184-
"temp": gpu_data.temp,
187+
"temp": _temp,
185188
"fan_speed": gpu_data.fan_speed,
186189
"histograms": {
187190
"utilization": "".join([self._get_histogram_bar(val, 0, 100) for val in self._gpu_util_history]),

0 commit comments

Comments
 (0)