forked from cucumber/cucumber-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (52 loc) · 2.71 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
MONOREPO_PATH ?= ../../cucumber
# https://stackoverflow.com/questions/2483182/recursive-wildcards-in-gnu-make
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
RUBY_FILES=$(call rwildcard,../lib ../../cucumber-ruby-core/lib/,*.rb)
FEATURES = $(sort $(wildcard features/docs/**.feature))
GOLDEN_JSONS = $(patsubst features/docs/%.feature,acceptance/%-golden.json,$(FEATURES))
GENERATED_JSONS = $(patsubst features/docs/%.feature,acceptance/%-generated.json,$(FEATURES))
TESTED = $(patsubst features/docs/%.feature,acceptance/%.tested,$(FEATURES))
OS := $(shell [[ "$$(uname)" == "Darwin" ]] && echo "darwin" || echo "linux")
# Determine if we're on 386 or amd64 (ignoring other processors as we're not building on them)
ARCH := $(shell [[ "$$(uname -m)" == "x86_64" ]] && echo "amd64" || echo "386")
default: $(GOLDEN_JSONS) $(GENERATED_JSONS) $(TESTED)
.PHONY: default
acceptance/%.tested: acceptance/%-golden.json acceptance/%-generated.json
mkdir -p $$(dirname $@)
diff --unified $^
.PHONY: acceptance/%.tested
acceptance/%-golden.json: features/docs/%.feature $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json $(RUBY_FILES)
mkdir -p $$(dirname $@)
bundle exec cucumber --format=json $< | \
jq --sort-keys "." | \
$(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json > $@
acceptance/%-generated.json: features/docs/%.feature $(RUBY_FILES) bin/json-formatter $(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json
mkdir -p $$(dirname $@)
bundle exec cucumber --format=message $< | \
bin/json-formatter --format ndjson | \
jq --sort-keys "." | \
$(MONOREPO_PATH)/compatibility-kit/ruby/scripts/neutralize-json > $@
bin/json-formatter: $(MONOREPO_PATH)/json-formatter/go/dist/cucumber-json-formatter-$(OS)-$(ARCH)
cp $(MONOREPO_PATH)/json-formatter/go/dist/cucumber-json-formatter-$(OS)-$(ARCH) $@
chmod +x $@
clean:
rm -rf acceptance/*.json bin/json-formatter
.PHONY: clean
release:
[ -d '../secrets' ] || git clone keybase://team/cucumberbdd/secrets ../secrets
git -C ../secrets pull
../secrets/update_permissions
docker run \
--volume "${shell pwd}":/app \
--volume "${shell pwd}/../secrets/import-gpg-key.sh":/home/cukebot/import-gpg-key.sh \
--volume "${shell pwd}/../secrets/codesigning.key":/home/cukebot/codesigning.key \
--volume "${shell pwd}/../secrets/.ssh":/home/cukebot/.ssh \
--volume "${shell pwd}/../secrets/.gem":/home/cukebot/.gem \
--volume "${HOME}/.gitconfig":/home/cukebot/.gitconfig \
--env CUCUMBER_USE_RELEASED_GEMS=1 \
--env-file ../secrets/secrets.list \
--user 1000 \
--rm \
-it cucumber/cucumber-build:latest \
bash -c "rm Gemfile.lock && bundle && bundle exec rake && bundle exec rake release"
.PHONY: release