mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
build: crossplatform build with packages.
Big thanks to @fg2it who created a POC as well as the build container that this work is based on.
This commit is contained in:
@@ -4,6 +4,12 @@
|
||||
# This script is executed from within the container.
|
||||
#
|
||||
|
||||
CCARMV7=arm-linux-gnueabihf-gcc
|
||||
CCARM64=aarch64-linux-gnu-gcc
|
||||
CCOSX64=/tmp/osxcross/target/bin/o64-clang
|
||||
CCWIN64=x86_64-w64-mingw32-gcc
|
||||
CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
|
||||
|
||||
GOPATH=/go
|
||||
REPO_PATH=$GOPATH/src/github.com/grafana/grafana
|
||||
|
||||
@@ -11,23 +17,45 @@ cd /go/src/github.com/grafana/grafana
|
||||
echo "current dir: $(pwd)"
|
||||
|
||||
if [ "$CIRCLE_TAG" != "" ]; then
|
||||
echo "Building a release from tag $CIRCLE_TAG"
|
||||
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} -includeBuildNumber=false build
|
||||
echo "Building releases from tag $CIRCLE_TAG"
|
||||
go run build.go -goarch armv7 -cc ${CCARMV7} -includeBuildNumber=false build
|
||||
go run build.go -goarch arm64 -cc ${CCARM64} -includeBuildNumber=false build
|
||||
go run build.go -goos darwin -cc ${CCOSX64} -includeBuildNumber=false build
|
||||
go run build.go -goos windows -cc ${CCWIN64} -includeBuildNumber=false build
|
||||
CC=${CCX64} go run build.go -includeBuildNumber=false build
|
||||
else
|
||||
echo "Building incremental build for $CIRCLE_BRANCH"
|
||||
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build
|
||||
go run build.go -goarch armv7 -cc ${CCARMV7} -buildNumber=${CIRCLE_BUILD_NUM} build
|
||||
go run build.go -goarch arm64 -cc ${CCARM64} -buildNumber=${CIRCLE_BUILD_NUM} build
|
||||
go run build.go -goos darwin -cc ${CCOSX64} -buildNumber=${CIRCLE_BUILD_NUM} build
|
||||
go run build.go -goos windows -cc ${CCWIN64} -buildNumber=${CIRCLE_BUILD_NUM} build
|
||||
CC=${CCX64} go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build
|
||||
fi
|
||||
|
||||
yarn install --pure-lockfile --no-progress
|
||||
|
||||
source /etc/profile.d/rvm.sh
|
||||
|
||||
echo "current dir: $(pwd)"
|
||||
|
||||
if [ "$CIRCLE_TAG" != "" ]; then
|
||||
echo "Packaging a release from tag $CIRCLE_TAG"
|
||||
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} -includeBuildNumber=false package latest
|
||||
else
|
||||
echo "Packaging incremental build for $CIRCLE_BRANCH"
|
||||
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} package latest
|
||||
if [ -d "dist" ]; then
|
||||
rm -rf dist
|
||||
fi
|
||||
|
||||
if [ "$CIRCLE_TAG" != "" ]; then
|
||||
echo "Building frontend from tag $CIRCLE_TAG"
|
||||
go run build.go -includeBuildNumber=false build-frontend
|
||||
echo "Packaging a release from tag $CIRCLE_TAG"
|
||||
go run build.go -goos linux -pkg-arch amd64 -includeBuildNumber=false package-only latest
|
||||
go run build.go -goos linux -pkg-arch armv7 -includeBuildNumber=false package-only
|
||||
go run build.go -goos linux -pkg-arch arm64 -includeBuildNumber=false package-only
|
||||
go run build.go -goos darwin -pkg-arch amd64 -includeBuildNumber=false package-only
|
||||
go run build.go -goos windows -pkg-arch amd64 -includeBuildNumber=false package-only
|
||||
else
|
||||
echo "Building frontend for $CIRCLE_BRANCH"
|
||||
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build-frontend
|
||||
echo "Packaging incremental build for $CIRCLE_BRANCH"
|
||||
go run build.go -goos linux -pkg-arch amd64 -buildNumber=${CIRCLE_BUILD_NUM} package-only latest
|
||||
go run build.go -goos linux -pkg-arch armv7 -buildNumber=${CIRCLE_BUILD_NUM} package-only
|
||||
go run build.go -goos linux -pkg-arch arm64 -buildNumber=${CIRCLE_BUILD_NUM} package-only
|
||||
go run build.go -goos darwin -pkg-arch amd64 -buildNumber=${CIRCLE_BUILD_NUM} package-only
|
||||
go run build.go -goos windows -pkg-arch amd64 -buildNumber=${CIRCLE_BUILD_NUM} package-only
|
||||
fi
|
||||
|
@@ -3,13 +3,20 @@ var path = require('path');
|
||||
module.exports = function(grunt) {
|
||||
"use strict";
|
||||
|
||||
// build, then zip and upload to s3
|
||||
// build then zip
|
||||
grunt.registerTask('release', [
|
||||
'build',
|
||||
'build-post-process',
|
||||
'compress:release'
|
||||
]);
|
||||
|
||||
// package into archives
|
||||
grunt.registerTask('package', [
|
||||
'clean:temp',
|
||||
'build-post-process',
|
||||
'compress:release'
|
||||
]);
|
||||
|
||||
grunt.registerTask('build-post-process', function() {
|
||||
grunt.config('copy.public_to_temp', {
|
||||
expand: true,
|
||||
@@ -18,7 +25,7 @@ module.exports = function(grunt) {
|
||||
dest: '<%= tempDir %>/public/',
|
||||
});
|
||||
grunt.config('copy.backend_bin', {
|
||||
cwd: 'bin',
|
||||
cwd: 'bin/<%= platform %>-<%= arch %>',
|
||||
expand: true,
|
||||
src: ['*'],
|
||||
options: { mode: true},
|
||||
|
Reference in New Issue
Block a user