Skip to content

v0.5.0: decouple control loop, curve editors, auto-update, UI redesign #3

v0.5.0: decouple control loop, curve editors, auto-update, UI redesign

v0.5.0: decouple control loop, curve editors, auto-update, UI redesign #3

Workflow file for this run

name: CI
on:
push:
branches: [main, beta]
tags: ["v*"]
pull_request:
branches: [main, beta]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test & Lint
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: MouseDrive
- name: Run tests
run: cargo test --manifest-path MouseDrive/Cargo.toml
- name: Clippy
run: cargo clippy --manifest-path MouseDrive/Cargo.toml -- -D warnings
release:
name: Build & Release
# yalnizca v* tag push'unda calisir (orn. v0.5.0)
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: MouseDrive
# surum tek kaynaktan gelir: tag. Cargo.toml'daki version satiri
# tag'den yazilir; boylece exe basligi, auto-update karsilastirmasi
# ve release adi her zaman tutarli olur.
- name: Set version from tag
shell: pwsh
run: |
$version = "${{ github.ref_name }}".TrimStart("v")
if ($version -notmatch '^\d+\.\d+\.\d+$') {
Write-Error "Gecersiz tag formati: ${{ github.ref_name }} (beklenen: vX.Y.Z)"
exit 1
}
$toml = Get-Content MouseDrive/Cargo.toml
$toml = $toml -replace '^version = ".*"$', "version = `"$version`""
Set-Content MouseDrive/Cargo.toml $toml -Encoding utf8
Write-Host "Cargo.toml version -> $version"
- name: Build release
run: cargo build --release --manifest-path MouseDrive/Cargo.toml
- name: Package
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$zipName = "MouseDrive-$tag-windows-x64.zip"
New-Item -ItemType Directory dist | Out-Null
Copy-Item MouseDrive/target/release/mousedrive.exe dist/
Copy-Item README.md, LICENSE dist/
Compress-Archive -Path dist/* -DestinationPath $zipName
# auto-update v2'nin dogrulayacagi checksum dosyasi
$hash = (Get-FileHash $zipName -Algorithm SHA256).Hash.ToLower()
"$hash $zipName" | Out-File SHA256SUMS.txt -Encoding ascii
Get-Content SHA256SUMS.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
MouseDrive-*-windows-x64.zip
SHA256SUMS.txt
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }}