mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Azure Pipelines: Retrieve build number from server, pass it to CMake
The script on our server bumps the build number for every new version + commit combination. Each combination is associated to a unique build number and vice versa. There's a separate counter for each version. The reason why we cannot just use "git describe --tags --dirty" is because it relies on the last tag's name and generates a string like "5.01.9674-212-g54280853". What we want, instead, is the last part of the version to be increased for every build. Then, once we consider the branch stable enough, we create a tag like "5.01" and bump the version immediately after the new release. Please note that for pull requests the build number will always be 0, because the secret token is only available in the Nightly pipeline.
This commit is contained in:
parent
943ddadd3d
commit
9620dcbcd0
@ -4,12 +4,11 @@ jobs:
|
|||||||
pool:
|
pool:
|
||||||
vmImage: ubuntu-16.04
|
vmImage: ubuntu-16.04
|
||||||
steps:
|
steps:
|
||||||
- script: |
|
- script: sudo apt-get -y install cmake gcc g++ ninja-build libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev
|
||||||
cd $BUILD_BINARIESDIRECTORY
|
displayName: 'Prepare environment'
|
||||||
sudo apt -y install cmake gcc g++ ninja-build libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev
|
- script: "$(Build.SourcesDirectory)/.ci/azure-pipelines/linux_build.sh"
|
||||||
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo $BUILD_SOURCESDIRECTORY
|
env:
|
||||||
cmake --build .
|
SE_BUILD_NUMBER_TOKEN: $(BUILD_NUMBER_TOKEN)
|
||||||
cpack -C Release -G DEB
|
|
||||||
displayName: 'Build'
|
displayName: 'Build'
|
||||||
- script: |
|
- script: |
|
||||||
.ci/appveyor-deb-install-test.sh
|
.ci/appveyor-deb-install-test.sh
|
||||||
|
15
.ci/azure-pipelines/linux_build.sh
Executable file
15
.ci/azure-pipelines/linux_build.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ "${#SE_BUILD_NUMBER_TOKEN}" -eq 64 ]]; then
|
||||||
|
VERSION=$(python3 "version.py")
|
||||||
|
BUILD_NUMBER=$(curl "https://softether.network/get-build-number?commit=${BUILD_SOURCEVERSION}&version=${VERSION}&token=${SE_BUILD_NUMBER_TOKEN}")
|
||||||
|
else
|
||||||
|
BUILD_NUMBER=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ${BUILD_BINARIESDIRECTORY}
|
||||||
|
|
||||||
|
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_NUMBER=${BUILD_NUMBER} ${BUILD_SOURCESDIRECTORY}
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
cpack -C Release -G DEB
|
@ -1,13 +1,11 @@
|
|||||||
jobs:
|
jobs:
|
||||||
- job: macOS
|
- job: macOS
|
||||||
displayName: 'macOS'
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: macOS-latest
|
vmImage: macOS-latest
|
||||||
steps:
|
steps:
|
||||||
- script: brew install cmake ninja ncurses readline openssl zlib
|
- script: brew install cmake ninja ncurses readline openssl zlib
|
||||||
displayName: 'Install packages'
|
displayName: 'Prepare environment'
|
||||||
- script: |
|
- script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/macos_build.sh'
|
||||||
cd $BUILD_BINARIESDIRECTORY
|
env:
|
||||||
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl $BUILD_SOURCESDIRECTORY
|
SE_BUILD_NUMBER_TOKEN: $(BUILD_NUMBER_TOKEN)
|
||||||
cmake --build .
|
|
||||||
displayName: 'Build'
|
displayName: 'Build'
|
||||||
|
13
.ci/azure-pipelines/macos_build.sh
Executable file
13
.ci/azure-pipelines/macos_build.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ "${#SE_BUILD_NUMBER_TOKEN}" -eq 64 ]]; then
|
||||||
|
VERSION=$(python "version.py")
|
||||||
|
BUILD_NUMBER=$(curl "https://softether.network/get-build-number?commit=${BUILD_SOURCEVERSION}&version=${VERSION}&token=${SE_BUILD_NUMBER_TOKEN}")
|
||||||
|
else
|
||||||
|
BUILD_NUMBER=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ${BUILD_BINARIESDIRECTORY}
|
||||||
|
|
||||||
|
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_NUMBER=${BUILD_NUMBER} -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl" ${BUILD_SOURCESDIRECTORY}
|
||||||
|
cmake --build .
|
@ -18,18 +18,14 @@ steps:
|
|||||||
vcpkg install openssl zlib --triplet ${{parameters.vcpkgTriplet}}
|
vcpkg install openssl zlib --triplet ${{parameters.vcpkgTriplet}}
|
||||||
workingDirectory: C:/vcpkg
|
workingDirectory: C:/vcpkg
|
||||||
displayName: 'Prepare environment'
|
displayName: 'Prepare environment'
|
||||||
- script: |
|
- script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/windows_build.bat'
|
||||||
call "${{parameters.vcvarsPath}}"
|
env:
|
||||||
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{parameters.vcpkgTriplet}} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER="${{parameters.compilerPath}}" -DCMAKE_CXX_COMPILER="${{parameters.compilerPath}}" $(Build.SourcesDirectory)
|
ARCHITECTURE: ${{parameters.architecture}}
|
||||||
cmake --build .
|
COMPILER_PATH: ${{parameters.compilerPath}}
|
||||||
workingDirectory: $(Build.BinariesDirectory)
|
VCPKG_TRIPLET: ${{parameters.vcpkgTriplet}}
|
||||||
|
VCVARS_PATH: ${{parameters.vcvarsPath}}
|
||||||
|
SE_BUILD_NUMBER_TOKEN: $(BUILD_NUMBER_TOKEN)
|
||||||
displayName: 'Build'
|
displayName: 'Build'
|
||||||
- script: |
|
|
||||||
mkdir "$(Build.StagingDirectory)/installers"
|
|
||||||
vpnsetup /SFXMODE:vpnclient /SFXOUT:"$(Build.StagingDirectory)/installers/softether-vpnclient-$(Build.SourceVersion)-${{parameters.architecture}}.exe"
|
|
||||||
vpnsetup /SFXMODE:vpnserver_vpnbridge /SFXOUT:"$(Build.StagingDirectory)/installers/softether-vpnserver_vpnbridge-$(Build.SourceVersion)-${{parameters.architecture}}.exe"
|
|
||||||
workingDirectory: $(Build.BinariesDirectory)
|
|
||||||
displayName: 'Build installers'
|
|
||||||
- powershell: |
|
- powershell: |
|
||||||
. .ci/appveyor-vpntest.ps1
|
. .ci/appveyor-vpntest.ps1
|
||||||
displayName: 'Test'
|
displayName: 'Test'
|
||||||
|
26
.ci/azure-pipelines/windows_build.bat
Normal file
26
.ci/azure-pipelines/windows_build.bat
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
@echo on
|
||||||
|
|
||||||
|
:: The method we use to store a command's output into a variable:
|
||||||
|
:: https://stackoverflow.com/a/6362922
|
||||||
|
for /f "tokens=* USEBACKQ" %%g in (`python "version.py"`) do (set "VERSION=%%g")
|
||||||
|
|
||||||
|
:: https://stackoverflow.com/a/8566001
|
||||||
|
echo %SE_BUILD_NUMBER_TOKEN%> "%tmp%\length.txt"
|
||||||
|
for %%? in ("%tmp%\length.txt") do ( set /A SE_BUILD_NUMBER_TOKEN_LENGTH=%%~z? - 2 )
|
||||||
|
|
||||||
|
if %SE_BUILD_NUMBER_TOKEN_LENGTH% equ 64 (
|
||||||
|
for /f "tokens=* USEBACKQ" %%g in (`curl "https://softether.network/get-build-number?commit=%BUILD_SOURCEVERSION%&version=%VERSION%&token=%SE_BUILD_NUMBER_TOKEN%"`) do (set "BUILD_NUMBER=%%g")
|
||||||
|
) else (
|
||||||
|
set BUILD_NUMBER=0
|
||||||
|
)
|
||||||
|
|
||||||
|
cd %BUILD_BINARIESDIRECTORY%
|
||||||
|
|
||||||
|
call "%VCVARS_PATH%"
|
||||||
|
|
||||||
|
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=%VCPKG_TRIPLET% -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER="%COMPILER_PATH%" -DCMAKE_CXX_COMPILER="%COMPILER_PATH%" -DBUILD_NUMBER=%BUILD_NUMBER% "%BUILD_SOURCESDIRECTORY%"
|
||||||
|
cmake --build .
|
||||||
|
|
||||||
|
mkdir "%BUILD_STAGINGDIRECTORY%\installers"
|
||||||
|
vpnsetup /SFXMODE:vpnclient /SFXOUT:"%BUILD_STAGINGDIRECTORY%\installers\softether-vpnclient-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
||||||
|
vpnsetup /SFXMODE:vpnserver_vpnbridge /SFXOUT:"%BUILD_STAGINGDIRECTORY%\installers\softether-vpnserver_vpnbridge-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
Loading…
Reference in New Issue
Block a user