-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23ac0d5
commit 909b664
Showing
4 changed files
with
156 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Infinity Works Ltd | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,44 @@ | ||
# Exporter yml variables | ||
NAME ?= github | ||
VERSION ?= 2.0.1 | ||
EXPORTER_REPO_URL ?= https://github.com/infinityworks/github-exporter | ||
EXPORTER_HEAD ?= 2.0.1-alpha | ||
|
||
IMPORT_PATH := $(subst https://,,$(EXPORTER_REPO_URL)) | ||
CLONED_REPO := $(GOPATH)/src/$(IMPORT_PATH) | ||
WORK_DIR := cd $(CLONED_REPO) && | ||
BINARY_NAME := $(NAME)-exporter | ||
|
||
TARGET_DIR = $(shell pwd)/target | ||
BINS_DIR = $(TARGET_DIR)/bin/linux_amd64 | ||
|
||
|
||
all: clean clone-repo build package | ||
|
||
clean: | ||
@echo "=== $(NAME) === [ clean ]: Removing cloned folder" | ||
@if [ ! -d $(GOPATH) ]; then \ | ||
echo "GOPATH is empty" ;\ | ||
exit 1 ;\ | ||
fi | ||
@CLONED_REPO="$(echo -e "${CLONED_REPO}" | tr -d '[:space:]')" | ||
@TARGET_DIR="$(echo -e "${TARGET_DIR}" | tr -d '[:space:]')" | ||
rm -rf $(CLONED_REPO) $(TARGET_DIR) | ||
|
||
clone-repo: clean | ||
@echo "=== $(NAME) === [ clone-repo ]:" | ||
git clone $(EXPORTER_REPO_URL) $(CLONED_REPO) | ||
$(WORK_DIR) git checkout $(EXPORTER_HEAD) | ||
|
||
build: clone-repo deps-only | ||
@echo "=== $(NAME) === [ build ]:" | ||
$(WORK_DIR) go build -v -o $(BINS_DIR)/$(BINARY_NAME) | ||
|
||
deps-only: clone-repo | ||
@echo "=== $(NAME) === [ deps ]: Installing package dependencies required by the project..." | ||
$(WORK_DIR) go mod download | ||
|
||
# Import fragments | ||
include ../../scripts/package.mk | ||
|
||
.PHONY: all build clone-repo clean deps-only |
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 @@ | ||
# name of the exporter, should mach with the folder name | ||
name: github | ||
# version of the package created | ||
version: 2.0.1 | ||
# URL to the git project hosting the exporter | ||
exporter_repo_url: https://github.com/infinityworks/github-exporter | ||
# Tag of the exporter to checkout | ||
exporter_tag: 2.0.1-alpha | ||
# Commit of the exporter to checkout (used if tag property is empty) | ||
exporter_commit: | ||
# Changelog to add to the new release | ||
exporter_changelog: https://github.com/infinityworks/github-exporter/releases | ||
# Enable packages for Linux | ||
package_linux: true | ||
# Enable packages for Windows | ||
package_windows: true | ||
# Exporter GUID used in the msi package Requiered if package_windows is set to true | ||
exporter_guid: FF235B75-27E1-4084-BEB9-AB73AC8419D5 | ||
# Lincense GUID used in the msi package Requiered if package_windows is set to true | ||
license_guid: 68C1E509-840A-41AC-B4A5-FE84772F15B3 |
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,71 @@ | ||
<# | ||
.SYNOPSIS | ||
This script creates the win .MSI | ||
#> | ||
param ( | ||
# Target architecture: amd64 (default) or 386 | ||
[ValidateSet("amd64", "386")] | ||
[string]$arch="amd64", | ||
[string]$pfx_passphrase="none", | ||
[string]$exporterName="", | ||
[string]$exporterURL="", | ||
[string]$exporterHead="", | ||
[string]$exporterGUID="", | ||
[string]$licenseGUID="", | ||
[string]$version="" | ||
) | ||
|
||
$env:GOPATH = go env GOPATH | ||
$env:GOOS = "windows" | ||
$env:GOARCH = $arch | ||
$env:GO111MODULE = "auto" | ||
|
||
$exporterBinaryName = "$exporterName-exporter.exe" | ||
$exporterRepo = [string]"$exporterURL" -replace 'https?://(www.)?' | ||
|
||
$projectRootPath = pwd | ||
|
||
|
||
echo "--- Cloning exporter Repo" | ||
Push-Location $env:GOPATH\src | ||
$ErrorActionPreference = "SilentlyContinue" | ||
git clone $exporterURL $exporterRepo | ||
$ErrorActionPreference = "Stop" | ||
Set-Location "$env:GOPATH\src\$exporterRepo" | ||
|
||
|
||
$ErrorActionPreference = "SilentlyContinue" | ||
git fetch -at | ||
git checkout "$exporterHead" | ||
$ErrorActionPreference = "Stop" | ||
|
||
echo "--- Downloading dependencies" | ||
$ErrorActionPreference = "SilentlyContinue" | ||
go mod download | ||
$ErrorActionPreference = "Stop" | ||
|
||
|
||
echo "--- Compiling exporter" | ||
go build -v -o $exporterBinaryName | ||
if (-not $?) | ||
{ | ||
echo "Failed building exporter" | ||
exit -1 | ||
} | ||
|
||
Pop-Location | ||
New-item -type directory -path .\exporters\$exporterName\target\bin\windows_$arch\ -Force | ||
Copy-Item "$env:GOPATH\src\$exporterRepo\$exporterBinaryName" -Destination ".\exporters\$exporterName\target\bin\windows_$arch\" -Force | ||
if (-not $?) | ||
{ | ||
echo "Failed building exporter" | ||
exit -1 | ||
} | ||
Copy-Item "$env:GOPATH\src\$exporterRepo\LICENSE" -Destination ".\exporters\$exporterName\target\bin\windows_$arch\$exporterName-LICENSE" -Force | ||
{ | ||
echo "Failed building exporter" | ||
exit -1 | ||
} | ||
|
||
$win_msi_build = Join-Path -Path $projectRootPath -ChildPath "\scripts\win_msi_build.ps1" | ||
& $win_msi_build -arch $arch -exporterName $exporterName -version $version -exporterGUID $exporterGUID -licenseGUID $licenseGUID -pfx_passphrase $pfx_passphrase |