Skip to content

Commit

Permalink
release_ci: fix RELATIVE_ARTIFACT_ARCHIVE and REPO_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Jan 21, 2025
1 parent 6b3bc62 commit b37492b
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
echo "IMAGEFLOW_TAG_SHA_SUFFIX=imageflow-${{ env.TAG_SHA_SUFFIX }}" >> $GITHUB_ENV
echo "IMAGEFLOW_TOOL_PATH=${{ env.REL_BINARIES_DIR }}imageflow_tool${{ contains(matrix.os, 'windows') && '.exe' || '' }}" >> $GITHUB_ENV
echo "ESTIMATED_ARTIFACT_URL=${{ env.HTTPS_IMAGEFLOW_NIGHTLIES }}/${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}" >> $GITHUB_ENV
echo "RELATIVE_ARTIFACT_ARCHIVE=./artifacts/github/${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}" >> $GITHUB_ENV
echo "RELATIVE_ARTIFACT_ARCHIVE=./artifacts/github/imageflow-${{ env.TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}" >> $GITHUB_ENV
echo "CARGO_PROFILE_TARGET_FEATURES_ARGS=--${{ env.PROFILE }} ${{ matrix.target && format('--target={0}',matrix.target) }} ${{ matrix.features && format('--features={0}',matrix.features) }}" >> $GITHUB_ENV
echo "CROSS_ARGS=--locked --${{ env.PROFILE }} ${{ matrix.features && format('--features={0}',matrix.features) }}" >> $GITHUB_ENV
echo "RUSTFLAGS=${{ matrix.target-cpu && format('-C target-cpu={0}',matrix.target-cpu) }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -282,7 +282,7 @@ jobs:
CI_TAG: ${{ github.ref_name }}
PACKAGE_SUFFIX: ${{ matrix.suffix }}
NUGET_RUNTIME: ${{ matrix.nuget-rid }}
REPO_NAME: ${{ github.repository }}
REPO_NAME: ${{env.GITHUB_REPOSITORY_OWNER}}\/${{env.GITHUB_REPOSITORY_NAME}}
BINARIES_DIR: "${{ github.workspace }}/${{ env.REL_BINARIES_DIR }}"

- name: "Create NuGet Package Imageflow.NativeRuntime.${{ matrix.nuget-rid }} in ./artifacts/nuget"
Expand All @@ -292,7 +292,7 @@ jobs:
CI_TAG: ${{ github.ref_name }}
PACKAGE_SUFFIX: ${{ matrix.suffix }}
NUGET_RUNTIME: ${{ matrix.nuget-rid }}
REPO_NAME: ${{ github.repository }}
REPO_NAME: ${{env.GITHUB_REPOSITORY_OWNER}}\/${{env.GITHUB_REPOSITORY_NAME}}
BINARIES_DIR: "${{ github.workspace }}/${{ env.REL_BINARIES_DIR }}"

- name: Upload ./artifacts/upload to S3
Expand Down
15 changes: 10 additions & 5 deletions .idea/runConfigurations/test_all.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 100 additions & 0 deletions batt.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# PowerShell Script to Assess Laptop Battery Efficiency

# Function to Get Battery Information
function Get-BatteryInfo {
$battery = Get-CimInstance -ClassName Win32_Battery
if ($battery) {
$batteryStatus = switch ($battery.BatteryStatus) {
1 { "Discharging" }
2 { "Charging" }
3 { "Fully Charged" }
default { "Unknown" }
}
return @{
"Charge Percentage" = "$($battery.EstimatedChargeRemaining)%"
"Charging Status" = $batteryStatus
"Design Capacity (mWh)" = $battery.DesignCapacity
"Full Charge Capacity (mWh)" = $battery.FullChargeCapacity
"Battery Health (%)" = "{0:N2}" -f (($battery.FullChargeCapacity / $battery.DesignCapacity) * 100)
}
} else {
return @{
"Battery Info" = "No battery detected."
}
}
}

# Function to Get Screen Brightness
function Get-ScreenBrightness {
$brightness = (Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightness).CurrentBrightness
return "$brightness%"
}

# Function to Get CPU Information
function Get-CPUInfo {
$cpu = Get-CimInstance -ClassName Win32_Processor
$currentClock = $cpu.CurrentClockSpeed
$maxClock = $cpu.MaxClockSpeed
$throttling = if ($currentClock -lt ($maxClock * 0.95)) { "Yes" } else { "No" }

return @{
"Current CPU Frequency (MHz)" = "$currentClock MHz"
"Max CPU Frequency (MHz)" = "$maxClock MHz"
"CPU Throttling Active" = $throttling
}
}

# Function to Get Power Plan
function Get-PowerPlan {
$powerPlan = powercfg /getactivescheme
if ($powerPlan) {
return ($powerPlan -split ': ')[1]
} else {
return "Unknown"
}
}

# Function to Get System Uptime
function Get-SystemUptime {
$uptime = (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime
$uptimeSpan = (Get-Date) - $uptime
return $uptimeSpan.ToString("dd\.hh\:mm\:ss")
}

# Function to Get Top Power-Consuming Processes
function Get-TopProcesses {
# Requires PowerShell 5.1 or later
$processes = Get-Process | Sort-Object -Property @{Expression={$_.PM + $_.WS}} -Descending | Select-Object -First 5 |
Select-Object Name, @{Name="Memory (MB)";Expression={[math]::round($_.PM / 1MB,2)}}, @{Name="Handles";Expression={$_.Handles}}
return $processes
}

# Collect All Information
$batteryInfo = Get-BatteryInfo
$brightness = Get-ScreenBrightness
$cpuInfo = Get-CPUInfo
$powerPlan = Get-PowerPlan
$uptime = Get-SystemUptime
$topProcesses = Get-TopProcesses

# Display Summary
Write-Output "===== Laptop Battery Efficiency Report =====`n"

Write-Output ">> Battery Information:"
$batteryInfo.GetEnumerator() | ForEach-Object { Write-Output " $_.Key : $_.Value" }
Write-Output ""

Write-Output ">> Screen Brightness: $brightness`n"

Write-Output ">> CPU Information:"
$cpuInfo.GetEnumerator() | ForEach-Object { Write-Output " $_.Key : $_.Value" }
Write-Output ""

Write-Output ">> Power Plan: $powerPlan`n"

Write-Output ">> System Uptime: $uptime`n"

Write-Output ">> Top 5 Power-Consuming Processes:"
$topProcesses | Format-Table -AutoSize

Write-Output "`n============================================="

0 comments on commit b37492b

Please sign in to comment.