|
| 1 | +name: Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*.*.*" |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + - main |
| 11 | + |
| 12 | +env: |
| 13 | + CARGO_TERM_COLOR: always |
| 14 | + |
| 15 | +jobs: |
| 16 | + # ── Check: runs on every PR and tag ────────────────────────────────────── |
| 17 | + check: |
| 18 | + name: Lint & Test |
| 19 | + runs-on: windows-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install Rust stable |
| 25 | + uses: dtolnay/rust-toolchain@stable |
| 26 | + with: |
| 27 | + components: clippy, rustfmt |
| 28 | + |
| 29 | + - name: Cache cargo registry |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: | |
| 33 | + ~/.cargo/registry |
| 34 | + ~/.cargo/git |
| 35 | + target |
| 36 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-cargo- |
| 39 | +
|
| 40 | + - name: Check formatting |
| 41 | + run: cargo fmt -- --check |
| 42 | + |
| 43 | + - name: Clippy (deny warnings) |
| 44 | + run: cargo clippy -- -D warnings |
| 45 | + |
| 46 | + - name: Run tests |
| 47 | + run: cargo test |
| 48 | + |
| 49 | + # ── Release: only on version tags ──────────────────────────────────────── |
| 50 | + release: |
| 51 | + name: Build Release Binary |
| 52 | + runs-on: windows-latest |
| 53 | + needs: check |
| 54 | + if: startsWith(github.ref, 'refs/tags/v') |
| 55 | + |
| 56 | + permissions: |
| 57 | + contents: write |
| 58 | + |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Install Rust stable |
| 63 | + uses: dtolnay/rust-toolchain@stable |
| 64 | + |
| 65 | + - name: Cache cargo registry |
| 66 | + uses: actions/cache@v4 |
| 67 | + with: |
| 68 | + path: | |
| 69 | + ~/.cargo/registry |
| 70 | + ~/.cargo/git |
| 71 | + target |
| 72 | + key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }} |
| 73 | + restore-keys: | |
| 74 | + ${{ runner.os }}-cargo-release- |
| 75 | +
|
| 76 | + - name: Build release binary |
| 77 | + run: cargo build --release |
| 78 | + |
| 79 | + - name: Rename binary with version |
| 80 | + shell: pwsh |
| 81 | + run: | |
| 82 | + $version = "${{ github.ref_name }}" |
| 83 | + $src = "target\release\ramp.exe" |
| 84 | + $dst = "ramp-${version}-windows-x64.exe" |
| 85 | + Copy-Item $src $dst |
| 86 | + Write-Host "Created: $dst" |
| 87 | +
|
| 88 | + - name: Generate SHA-256 checksum |
| 89 | + shell: pwsh |
| 90 | + run: | |
| 91 | + $version = "${{ github.ref_name }}" |
| 92 | + $file = "ramp-${version}-windows-x64.exe" |
| 93 | + $hash = (Get-FileHash $file -Algorithm SHA256).Hash.ToLower() |
| 94 | + "$hash $file" | Out-File -Encoding ascii "${file}.sha256" |
| 95 | + Write-Host "SHA256: $hash" |
| 96 | +
|
| 97 | + - name: Create GitHub Release |
| 98 | + uses: softprops/action-gh-release@v2 |
| 99 | + with: |
| 100 | + name: "RAMP ${{ github.ref_name }}" |
| 101 | + draft: false |
| 102 | + prerelease: ${{ contains(github.ref_name, '-') }} |
| 103 | + generate_release_notes: true |
| 104 | + body: | |
| 105 | + ## Installation |
| 106 | +
|
| 107 | + 1. Download `ramp-${{ github.ref_name }}-windows-x64.exe` and place it at `C:\ramp\ramp.exe` |
| 108 | + 2. Extract [Apache 2.4 (Win64, VS17)](https://www.apachelounge.com/download/) into `C:\ramp\apache\` |
| 109 | + 3. Extract [MySQL 9.x (ZIP)](https://dev.mysql.com/downloads/mysql/) into `C:\ramp\mysql\` |
| 110 | + 4. Install [Visual C++ Redistributable 2022 x64](https://aka.ms/vs/17/release/vc_redist.x64.exe) |
| 111 | + 5. Run `ramp.exe` — first-launch provisioning is automatic |
| 112 | +
|
| 113 | + Verify the download with the `.sha256` file: |
| 114 | + ```powershell |
| 115 | + Get-FileHash ramp-${{ github.ref_name }}-windows-x64.exe -Algorithm SHA256 |
| 116 | + ``` |
| 117 | +
|
| 118 | + See [README](https://github.com/${{ github.repository }}/blob/master/README.md) for full documentation. |
| 119 | + files: | |
| 120 | + ramp-${{ github.ref_name }}-windows-x64.exe |
| 121 | + ramp-${{ github.ref_name }}-windows-x64.exe.sha256 |
0 commit comments