Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Azure Pipelines support for CI builds (#51)
* Fixed script macros throwing warnings for armake Used macros from ace3 repo * Fixed armake throwing errors on Linux * Git ignore unused files * Changed editorconfig settings for yaml, makefile * Added getArmake PowerShell tool Stripped down version of BearMitUmlaut's make.ps1 from ace3 * Auto version * Added Makefile * Added yml for Azure Pipelines * Fixed missing newline character
- Loading branch information
Showing
10 changed files
with
248 additions
and
22 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,7 @@ Thumbs.db | |
CHANGELOG.md | ||
.hephaestus.json | ||
*.bisign | ||
*.tar.gz | ||
*.zip | ||
@zen | ||
tools/armake.exe |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
VERSION = $(shell cat "VERSION") | ||
PREFIX = zen | ||
BIN = @zen | ||
ZIP = zen | ||
FLAGS = -i include -w unquoted-string -w redefinition-wo-undef | ||
VERSION_FILES = README.md mod.cpp | ||
|
||
MAJOR = $(word 1, $(subst ., ,$(VERSION))) | ||
MINOR = $(word 2, $(subst ., ,$(VERSION))) | ||
PATCH = $(word 3, $(subst ., ,$(VERSION))) | ||
BUILD = $(word 4, $(subst ., ,$(VERSION))) | ||
VERSION_S = $(MAJOR).$(MINOR).$(PATCH) | ||
VERSION_F = $(MAJOR).$(MINOR).$(PATCH).$(BUILD) | ||
GIT_HASH = $(shell git log -1 --pretty=format:"%H" | head -c 8) | ||
|
||
ifeq ($(OS), Windows_NT) | ||
ARMAKE = ./tools/armake.exe # Downloaded via tools/getArmake.ps1 | ||
else | ||
ARMAKE = armake | ||
endif | ||
|
||
$(BIN)/addons/$(PREFIX)_%.pbo: addons/% | ||
@mkdir -p $(BIN)/addons | ||
@echo " PBO $@" | ||
@${ARMAKE} build ${FLAGS} -f -e "version=$(GIT_HASH)" $< $@ | ||
|
||
$(BIN)/optionals/$(PREFIX)_%.pbo: optionals/% | ||
@mkdir -p $(BIN)/optionals | ||
@echo " PBO $@" | ||
@${ARMAKE} build ${FLAGS} -f -e "version=$(GIT_HASH)" $< $@ | ||
|
||
# Shortcut for building single addons (eg. "make <component>.pbo") | ||
%.pbo: | ||
"$(MAKE)" $(MAKEFLAGS) $(patsubst %, $(BIN)/addons/$(PREFIX)_%, $@) | ||
|
||
all: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo, $(wildcard addons/*)) \ | ||
$(patsubst optionals/%, $(BIN)/optionals/$(PREFIX)_%.pbo, $(wildcard optionals/*)) | ||
|
||
filepatching: | ||
"$(MAKE)" $(MAKEFLAGS) FLAGS="-w unquoted-string -p" | ||
|
||
$(BIN)/keys/%.biprivatekey: | ||
@mkdir -p $(BIN)/keys | ||
@echo " KEY $@" | ||
@${ARMAKE} keygen -f $(patsubst $(BIN)/keys/%.biprivatekey, $(BIN)/keys/%, $@) | ||
|
||
$(BIN)/addons/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign: $(BIN)/addons/$(PREFIX)_%.pbo $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey | ||
@echo " SIG $@" | ||
@${ARMAKE} sign -f -s $@ $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey $< | ||
|
||
$(BIN)/optionals/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign: $(BIN)/optionals/$(PREFIX)_%.pbo $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey | ||
@echo " SIG $@" | ||
@${ARMAKE} sign -f -s $@ $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey $< | ||
|
||
signatures: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign, $(wildcard addons/*)) \ | ||
$(patsubst optionals/%, $(BIN)/optionals/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign, $(wildcard optionals/*)) | ||
|
||
version: | ||
@echo " VER $(VERSION)" | ||
$(shell sed -i -r -s 's/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/$(VERSION)/g' $(VERSION_FILES)) | ||
$(shell sed -i -r -s 's/[0-9]+\.[0-9]+\.[0-9]+/$(VERSION_S)/g' $(VERSION_FILES)) | ||
@printf "#define MAJOR $(MAJOR)%s\n#define MINOR $(MINOR)%s\n#define PATCHLVL $(PATCH)%s\n#define BUILD $(BUILD)%s\n" > "addons/main/script_version.hpp" | ||
|
||
commit: | ||
@echo " GIT commit release preparation" | ||
@git add -A | ||
@git diff-index --quiet HEAD || git commit -am "Prepare release $(VERSION_S)" -q | ||
|
||
push: commit | ||
@echo " GIT push release preparation" | ||
@git push -q | ||
|
||
release: clean version commit | ||
@"$(MAKE)" $(MAKEFLAGS) signatures | ||
@echo " ZIP $(ZIP)_$(VERSION_F)-$(GIT_HASH).zip" | ||
@cp mod.cpp README.md AUTHORS.txt LICENSE logo_zen_ca.paa logo_zen_small_ca.paa $(BIN) | ||
@zip -qr $(ZIP)_$(VERSION_F)-$(GIT_HASH).zip $(BIN) | ||
|
||
releaseCI: clean version | ||
@"$(MAKE)" $(MAKEFLAGS) signatures | ||
@echo " TAR $(ZIP)_$(VERSION_F)-$(GIT_HASH).tar.gz" | ||
@cp mod.cpp README.md AUTHORS.txt LICENSE logo_zen_ca.paa logo_zen_small_ca.paa $(BIN) | ||
@tar -czf $(ZIP)_$(VERSION_F)-$(GIT_HASH).tar.gz $(BIN) | ||
@ls | ||
|
||
clean: | ||
rm -rf $(BIN) $(ZIP)_*.zip | ||
rm -rf $(BIN) $(ZIP)_*.tar.gz | ||
|
||
.PHONY: all filepatching signatures version commit push release releaseCI clean |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.1.0.4 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
jobs: | ||
- job: Build | ||
pool: | ||
vmImage: 'vs2017-win2016' | ||
steps: | ||
- powershell: | | ||
./tools/getArmake.ps1 | ||
displayName: 'Install armake' | ||
- bash: | | ||
make releaseCI | ||
displayName: 'Build with armake' | ||
- powershell: | | ||
ls *.tar.gz | ||
mv (ls *.tar.gz).Name $(Build.ArtifactStagingDirectory) | ||
ls $(Build.ArtifactStagingDirectory) | ||
displayName: 'Move tar to Artifact Directory' | ||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
pathtoPublish: $(Build.ArtifactStagingDirectory) | ||
artifactName: release |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
$projectRoot = Split-Path -Parent $PSScriptRoot | ||
$releasePage = "https://github.com/KoffeinFlummi/armake/releases" | ||
$downloadPage = "https://github.com/KoffeinFlummi/armake/releases/download/v{0}/armake_v{0}.zip" | ||
$armake = "$projectRoot\tools\armake.exe" | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
|
||
|
||
function Compare-VersionNewerThan { | ||
param( | ||
[Parameter(Mandatory=$True)] | ||
$version1, | ||
|
||
[Parameter(Mandatory=$True)] | ||
$version2 | ||
) | ||
|
||
$version1 = $version1.Split(".") | % {[int] $_} | ||
$version2 = $version2.Split(".") | % {[int] $_} | ||
|
||
$newer = $False | ||
for ($i = 0; $i -lt $version1.Length; $i++) { | ||
if ($version1[$i] -gt $version2[$i]) { | ||
$newer = $True | ||
break | ||
} | ||
} | ||
|
||
$newer | ||
} | ||
|
||
|
||
function Get-InstalledArmakeVersion { | ||
if (Test-Path $armake) { | ||
$version = & $armake --version | ||
$version = $version.Substring(1) | ||
} else { | ||
$version = "0.0.0" | ||
} | ||
|
||
$version | ||
} | ||
|
||
|
||
function Get-LatestArmakeVersion { | ||
$client = New-Object Net.WebClient | ||
$content = $client.DownloadString($releasePage) | ||
$client.dispose() | ||
|
||
$match = $content -match "<a href="".*?/releases/download/v(.*?)/.*?.zip"".*?>" | ||
if (!$match) { | ||
Write-Error "Failed to find valid armake download link." | ||
$version = "0.0.0" | ||
} else { | ||
$version = $matches[1] | ||
} | ||
|
||
$version | ||
} | ||
|
||
|
||
function Update-Armake { | ||
param( | ||
[Parameter(Mandatory=$True)] | ||
$url | ||
) | ||
|
||
New-Item "$PSScriptRoot\temp" -ItemType "directory" -Force | Out-Null | ||
|
||
Write-Output "Downloading armake..." | ||
$client = New-Object Net.WebClient | ||
$client.DownloadFile($url, "$PSScriptRoot\temp\armake.zip") | ||
$client.dispose() | ||
|
||
Write-Output "Download complete, unpacking..." | ||
Expand-Archive "$PSScriptRoot\temp\armake.zip" "$PSScriptRoot\temp\armake" | ||
Remove-Item "$PSScriptRoot\temp\armake.zip" | ||
|
||
if ([Environment]::Is64BitProcess) { | ||
$binary = Get-ChildItem -Path "$PSScriptRoot\temp\armake" -Include "*.exe" -Recurse | Where-Object {$_.Name -match ".*w64.exe"} | ||
} else { | ||
$binary = Get-ChildItem -Path "$PSScriptRoot\temp\armake" -Include "*.exe" -Recurse | Where-Object {$_.Name -match ".*w64.exe"} | ||
} | ||
Move-Item $binary.FullName $armake -Force | ||
|
||
Remove-Item "$PSScriptRoot\temp" -Recurse -Force | ||
} | ||
|
||
function Main { | ||
$installed = Get-InstalledArmakeVersion | ||
$latest = Get-LatestArmakeVersion | ||
|
||
if (Compare-VersionNewerThan $latest $installed) { | ||
Write-Output "Found newer version of armake:" " Installed: $installed" " Latest: $latest" | ||
Update-Armake ($downloadPage -f $latest) | ||
Write-Output "Update complete, armake up-to-date." | ||
} | ||
} | ||
|
||
Main |