Skip to content

Use mise for all of build and deployment #197

Use mise for all of build and deployment

Use mise for all of build and deployment #197

---
name: Lint package configs
# yamllint disable-line rule:truthy
on:
push:
branches:
- dev
paths:
- ".scripts/**/*.spec"
- ".scripts/**/*.desktop"
- ".scripts/**/*.template"
- ".scripts/**/*.nsi.template"
- ".scripts/**/*PKGBUILD*"
- ".scripts/**/*.flatpak.yml"
- ".scripts/**/*.flatpak.json"
pull_request:
paths:
- ".scripts/**/*.spec"
- ".scripts/**/*.desktop"
- ".scripts/**/*.template"
- ".scripts/**/*.nsi.template"
- ".scripts/**/*PKGBUILD*"
- ".scripts/**/*.flatpak.yml"
- ".scripts/**/*.flatpak.json"
workflow_dispatch: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-desktop-entry:
name: Lint desktop entry
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Desktop Entry validator
run: |
sudo apt-get update
sudo apt-get install -y desktop-file-utils
- name: Validate desktop file
run: |
desktop-file-validate .scripts/linux/system-bridge.desktop
lint-debian-control:
name: Lint debian control
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev gettext-base
- name: Validate Debian control file
run: |
# Create a temporary directory structure
mkdir -p debian/DEBIAN
VERSION=1.0.0 envsubst < .scripts/linux/control.template > debian/DEBIAN/control
# Validate control file syntax
dpkg-parsechangelog -l debian/DEBIAN/control || echo "Control file validation failed"
# Additional basic validation
grep -q "^Package:" debian/DEBIAN/control || exit 1
grep -q "^Version:" debian/DEBIAN/control || exit 1
grep -q "^Architecture:" debian/DEBIAN/control || exit 1
grep -q "^Description:" debian/DEBIAN/control || exit 1
lint-rpm-spec:
name: Lint rpm spec
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install rpm tools
run: |
sudo apt-get update
sudo apt-get install -y rpm rpmlint
- name: Lint rpm spec
run: |
rpmlint .scripts/linux/system-bridge.spec
lint-nsis:
name: Lint nsis script
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install nsis
run: |
choco install nsis -y
- name: Create dummy files for validation
run: |
# Create dist directory for NSIS output
New-Item -ItemType Directory -Path ".scripts/windows/now-playing" -Force
# Create an empty file to serve as the dummy executable for the now-playing helper
New-Item -ItemType File -Path ".scripts/windows/now-playing/NowPlaying.exe" -Force
# Create dist directory for NSIS output
New-Item -ItemType Directory -Path "dist" -Force
# Create an empty file to serve as the dummy executable for the main application
New-Item -ItemType File -Path "dist/system-bridge.exe" -Force
# Create dist directory for NSIS output
New-Item -ItemType Directory -Path "dist" -Force
- name: Validate nsis script
run: |
$version = '5.0.0-dev+123a4bcd'
$templateContent = Get-Content -Path ".scripts/windows/installer.nsi.template" -Raw
$YEAR = (Get-Date).Year
if ($VERSION -match "^(\d+)\.(\d+)\.(\d+)") {
$major = $matches[1]
$minor = $matches[2]
$patch = $matches[3]
$build = 0
$DOT_VERSION = "$major.$minor.$patch.$build"
} else {
$DOT_VERSION = "0.0.0.0"
}
$installerScript = $templateContent -replace '\$VERSION', $VERSION -replace '\$YEAR', $YEAR -replace '\$DOT_VERSION', $DOT_VERSION
Set-Content -Path "installer.nsi" -Value $installerScript
# Find makensis executable (same logic as create-installer.ps1)
$makensisCmd = Get-Command makensis -ErrorAction SilentlyContinue
if ($makensisCmd) {
$makensisPath = $makensisCmd.Source
} else {
# Try common installation paths
$possiblePaths = @(
"${env:ProgramFiles(x86)}\NSIS\makensis.exe",
"${env:ProgramFiles}\NSIS\makensis.exe",
"$env:ChocolateyInstall\lib\nsis\tools\makensis.exe",
"C:\ProgramData\chocolatey\lib\nsis\tools\makensis.exe"
)
foreach ($path in $possiblePaths) {
if (Test-Path $path) {
$makensisPath = $path
break
}
}
}
if (-not $makensisPath) {
Write-Error "makensis not found. Please ensure NSIS is installed correctly."
exit 1
}
# Check for syntax errors in NSIS script (this is a basic check, it just tries to compile)
& $makensisPath /V2 installer.nsi
lint-arch-pkgbuild:
name: Lint arch pkgbuild
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Docker
uses: docker/setup-buildx-action@v4
- name: Validate pkgbuild with Arch Linux container
run: |
docker run --rm -v ${{ github.workspace }}:/workspace archlinux:latest bash -c "
pacman -Sy --noconfirm namcap
cd /workspace
for pkgbuild in \$(find .scripts -name \"PKGBUILD*\"); do
echo \"Validating \$pkgbuild\"
namcap \"\$pkgbuild\"
done
"
lint-flatpak:
name: Lint flatpak manifest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install flatpak tools
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
- name: Cache Flatpak SDK and builder
uses: actions/cache@v5
with:
path: |
/var/lib/flatpak
~/.cache/flatpak-builder
key: ${{ runner.os }}-flatpak-${{ hashFiles('.scripts/linux/dev.timmo.system-bridge.yml') }}
restore-keys: |
${{ runner.os }}-flatpak-
- name: Add Flathub repository and install SDK
run: |
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y flathub org.freedesktop.Sdk//24.08
sudo flatpak install -y flathub org.freedesktop.Platform//24.08
- name: Create dummy binary for validation
run: |
touch system-bridge-linux
chmod +x system-bridge-linux
- name: Replace pkgver in flatpak manifest with 5.0.0
run: |
sed -i "s/pkgver=${VERSION}/pkgver=5.0.0/g" .scripts/linux/dev.timmo.system-bridge.yml
- name: Validate flatpak manifest
run: |
flatpak-builder --repo=test-repo --force-clean --disable-download app ".scripts/linux/dev.timmo.system-bridge.yml" || exit 1