feat: add Windows high-performance mode #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Release | |
| on: | |
| push: | |
| branches: | |
| - '**' # Build on every push to any branch | |
| tags: | |
| - 'v*' # Also trigger on version tags for release | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build for ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| asset_name: HexHunter-windows-amd64.exe | |
| goos: windows | |
| goarch: amd64 | |
| - os: ubuntu-latest | |
| asset_name: HexHunter-linux-amd64 | |
| goos: linux | |
| goarch: amd64 | |
| - os: macos-latest | |
| asset_name: HexHunter-macos-arm64 | |
| goos: darwin | |
| goarch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.23' | |
| - name: Download dependencies | |
| run: go mod download | |
| # Linux-specific: Install OpenCL headers/loaders | |
| - name: Install OpenCL (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ocl-icd-opencl-dev | |
| # Windows-specific: Compile resources (manifest, version info) | |
| - name: Compile Windows Resources | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Push-Location cmd/hexhunter | |
| windres -o resource.syso resource.rc | |
| Pop-Location | |
| # Build Command - Platform specific | |
| - name: Build (Windows) | |
| if: runner.os == 'Windows' | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 1 | |
| run: | | |
| go build -tags opencl -trimpath -ldflags "-s -w" -o ${{ matrix.asset_name }} ./cmd/hexhunter | |
| - name: Build (Linux) | |
| if: runner.os == 'Linux' | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 1 | |
| run: | | |
| go build -tags opencl -trimpath -ldflags "-s -w" -o ${{ matrix.asset_name }} ./cmd/hexhunter | |
| - name: Build (macOS) | |
| if: runner.os == 'macOS' | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| go build -trimpath -ldflags "-s -w" -o ${{ matrix.asset_name }} ./cmd/hexhunter | |
| # Upload Build Artifacts (always, for debugging) | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binary-${{ matrix.os }} | |
| path: ${{ matrix.asset_name }} | |
| retention-days: 3 | |
| # Release job - only runs on version tags | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') # Only on v* tags | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: binary-* | |
| merge-multiple: true | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: HexHunter-* | |
| name: Release ${{ github.ref_name }} | |
| tag_name: ${{ github.ref_name }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |