mirror of
https://github.com/koho/frpmgr.git
synced 2025-10-20 16:03:47 +08:00
79 lines
2.3 KiB
YAML
79 lines
2.3 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
architecture: [x64, x86, arm64]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go environment
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Setup VS environment
|
|
shell: powershell
|
|
run: echo "$(vswhere.exe -latest -property installationPath)\VC\Auxiliary\Build" >> $env:GITHUB_PATH
|
|
|
|
- name: Setup toolchain
|
|
shell: cmd
|
|
run: |
|
|
curl "https://github.com/mstorsjo/llvm-mingw/releases/download/20250709/llvm-mingw-20250709-msvcrt-x86_64.zip" -o llvm-mingw-20250709-msvcrt-x86_64.zip -L
|
|
tar -xf llvm-mingw-20250709-msvcrt-x86_64.zip
|
|
echo %CD%\llvm-mingw-20250709-msvcrt-x86_64\bin>>%GITHUB_PATH%
|
|
vcvarsall x64 && set WindowsSdkVerBinPath >> %GITHUB_ENV%
|
|
|
|
- name: Add commit hash to version number
|
|
shell: powershell
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
$versionFile = ".\pkg\version\version.go"
|
|
$rev = [UInt16]("0x" + $env:HEAD_SHA.Substring(0, 4))
|
|
$version = (findstr /r "Number.*=.*[0-9.]*" $versionFile | Select-Object -First 1 | ConvertFrom-StringData).Get_Item("Number")
|
|
$newVersion = $version.Substring(0, $version.Length - 1) + ".$rev" + '"'
|
|
(Get-Content $versionFile).Replace($version, $newVersion) | Set-Content $versionFile
|
|
echo "VERSION=$($newVersion.Replace('"', ''))" >> $env:GITHUB_ENV
|
|
|
|
- name: Build
|
|
shell: cmd
|
|
run: build.bat ${{ matrix.architecture }}
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
name: frpmgr-${{ env.VERSION }}-test-${{ matrix.architecture }}
|
|
path: |
|
|
bin/*.exe
|
|
bin/*.zip
|
|
retention-days: 7
|
|
|
|
test:
|
|
name: Go
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go environment
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: Test
|
|
run: go test -v ./...
|