Skip to content

Commit

Permalink
Inject sha information via env
Browse files Browse the repository at this point in the history
Move git rev-parse to Makefile
  • Loading branch information
bcardiff committed Oct 23, 2018
1 parent b27a8f8 commit b20dc6b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ defaults:
environment: &env
TRAVIS_BRANCH: $CIRCLE_BRANCH
TRAVIS_PULL_REQUEST: $CI_PULL_REQUEST || "false"
CURRENT_TAG: $CIRCLE_TAG
steps: &ci_steps
- checkout
- run: bin/ci prepare_system
- run: export CURRENT_TAG=$CIRCLE_TAG
- run: bin/ci prepare_build
- run: bin/ci build

Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ services:
matrix:
fast_finish: true
include:
- env: ARCH=i386 ARCH_CMD=linux32 CURRENT_TAG=$TRAVIS_TAG
- env: ARCH=i386 ARCH_CMD=linux32
os: linux
- env: ARCH=x86_64 ARCH_CMD=linux64 CURRENT_TAG=$TRAVIS_TAG
- env: ARCH=x86_64 ARCH_CMD=linux64
os: linux

git:
Expand All @@ -23,6 +23,7 @@ before_install:
- bin/ci prepare_system

install:
- export CURRENT_TAG=$TRAVIS_TAG
- bin/ci prepare_build

script:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ SOURCES := $(shell find src -name '*.cr')
SPEC_SOURCES := $(shell find spec -name '*.cr')
override FLAGS += $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )
SPEC_FLAGS := $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )
EXPORTS := $(if $(release),,CRYSTAL_CONFIG_PATH="$(PWD)/src")
CRYSTAL_CONFIG_SHA := $(shell git rev-parse --short HEAD 2> /dev/null)
EXPORTS := $(if $(release),,CRYSTAL_CONFIG_PATH="$(PWD)/src") CRYSTAL_CONFIG_SHA="$(CRYSTAL_CONFIG_SHA)"
SHELL = sh
LLVM_CONFIG_FINDER := \
[ -n "$(LLVM_CONFIG)" ] && command -v "$(LLVM_CONFIG)" || \
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Crystal
end

def self.sha
sha = {{ `(git rev-parse --short HEAD 2> /dev/null) || true`.stringify.chomp }}
sha = {{ env("CRYSTAL_CONFIG_SHA") || "" }}
sha = nil if sha.empty?

sha
Expand Down

0 comments on commit b20dc6b

Please sign in to comment.