Skip to content

fix: windows-100 rule desc syntax #24

fix: windows-100 rule desc syntax

fix: windows-100 rule desc syntax #24

Workflow file for this run

name: Build SysHardn Binaries
on:
push:
branches: [ main, dev ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
- name: Run tests
run: |
python -m pytest tests/ -v --cov=src/syshardn --cov-report=term-missing
build-linux-x86:
name: Build Linux Binary (x86_64)
needs: test
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y binutils
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller pytest pytest-cov
- name: Build Linux binary
run: |
chmod +x build.sh
./build.sh
- name: Test binary
run: |
BINARY=$(ls dist/syshardn-*-linux-* | head -1)
chmod +x "$BINARY"
"$BINARY" --help
"$BINARY" list-rules
- name: Upload Linux binary
uses: actions/upload-artifact@v4
with:
name: syshardn-linux-x86_64
path: dist/syshardn-*-linux-*
if-no-files-found: error
build-linux-arm64:
name: Build Linux Binary (arm64)
needs: test
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install QEMU for Docker emulation
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static binfmt-support
docker run --rm --privileged tonistiigi/binfmt --install all
- name: Build Linux binary (arm64 via Docker)
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
docker run --rm \
--platform linux/arm64/v8 \
-v "$PWD":/workspace \
-w /workspace \
python:3.12-slim bash -c "
apt-get update &&
apt-get install -y binutils &&
python -m pip install --upgrade pip &&
pip install -r requirements.txt pyinstaller pytest pytest-cov &&
chmod +x build.sh &&
./build.sh
"
- name: Fix permissions (arm64)
run: sudo chown -R $USER:$USER dist
- name: Upload Linux binary (arm64)
uses: actions/upload-artifact@v4
with:
name: syshardn-linux-arm64
path: dist/syshardn-*-linux-*
if-no-files-found: error
build-windows:
name: Build Windows Binary
needs: test
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller pytest pytest-cov
- name: Build Windows binary
run: |
.\build.ps1
- name: Test binary
run: |
$binary = Get-ChildItem dist\syshardn-*-windows-*.exe | Select-Object -First 1
& $binary.FullName --help
& $binary.FullName list-rules
- name: Upload Windows binary
uses: actions/upload-artifact@v4
with:
name: syshardn-windows-x86_64
path: dist/syshardn-*-windows-*
if-no-files-found: error
create-dev-release:
name: Create Dev Pre-Release
needs: [build-linux-x86, build-windows]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure
run: ls -R artifacts
- name: Create checksums
run: |
cd artifacts
for dir in */; do
cd "$dir"
for file in *; do
if [ -f "$file" ] && [[ "$file" != *.sha256 ]]; then
sha256sum "$file" > "${file}.sha256"
fi
done
cd ..
done
- name: Delete previous dev release
continue-on-error: true
run: |
gh release delete dev-latest --yes --cleanup-tag || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Dev Pre-Release
uses: softprops/action-gh-release@v2
with:
name: "Development Build (Latest)"
tag_name: dev-latest
files: artifacts/**/*
draft: false
prerelease: true
generate_release_notes: false
body: |
## Development Build - Latest from `dev` branch
This is an automated pre-release build from the development branch.
- Not recommended for production use
- May contain experimental features or bugs
- Build date: ${{ github.event.head_commit.timestamp }}
- Commit: ${{ github.sha }}
### Downloads
See attached binaries for Linux (x86_64) and Windows (x86_64).
For stable releases, see: https://github.com/${{ github.repository }}/releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-release:
name: Create Release
needs: [build-linux-x86, build-linux-arm64, build-windows]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure
run: ls -R artifacts
- name: Create checksums
run: |
cd artifacts
for dir in */; do
cd "$dir"
for file in *; do
if [ -f "$file" ] && [[ "$file" != *.sha256 ]]; then
sha256sum "$file" > "${file}.sha256"
fi
done
cd ..
done
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
draft: false
prerelease: false
generate_release_notes: true
body: |
## SysHardn Release ${{ github.ref_name }}
### Downloads
- **Ubuntu 22.04 LTS (x86_64, tarball):** `syshardn-v*-linux-x86_64.tar.gz`
- **Ubuntu 22.04 LTS (arm64/aarch64 via QEMU, tarball):** `syshardn-v*-linux-aarch64.tar.gz`
- **Windows Server 2022 (x86_64, zip + exe):** `syshardn-v*-windows-x64.zip`, `syshardn-v*-windows-x64.exe`
### Supported Platforms
- Windows 10 and Windows 11 (x86_64)
- Ubuntu 20.04 LTS and newer (x86_64/arm64)
- CentOS 7 and newer (x86_64)
### Installation
#### Linux
```bash
# Download the tarball for your architecture
tar -xzf syshardn-v*-linux-<arch>.tar.gz
chmod +x syshardn-v*-linux-<arch>
./syshardn-v*-linux-<arch> --help
```
#### Windows
```powershell
# Download and extract the zip package
Expand-Archive -Path .\syshardn-v*-windows-x64.zip -DestinationPath .\syshardn
.\syshardn\syshardn-v*-windows-x64.exe --help
```
### Verification
Verify the download using SHA256 checksums (*.sha256 files included).
### Quick Start
```bash
# List available rules
./syshardn list-rules
# Check compliance (read-only)
sudo ./syshardn check --level basic --dry-run
# Generate report
sudo ./syshardn report --format html
```
For full documentation, see [README.md](https://github.com/${{ github.repository }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}