Tests #164
This file contains 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: Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
- name: Setup VS environment | |
shell: cmd | |
run: | | |
for /f "usebackq delims=" %%i in (`vswhere.exe -latest -property installationPath`) do echo %%i\VC\Auxiliary\Build>>%GITHUB_PATH% | |
- 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 | |
- name: Build | |
shell: cmd | |
run: build.bat | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
name: build | |
path: | | |
bin/*.exe | |
bin/*.zip | |
retention-days: 5 | |
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.22' | |
- name: Test | |
run: go test -v ./... |