Skip to content

Commit 8939eba

Browse files
authored
[PLATFORM-2804] Add Yarn and CircleCI configuration (#23)
* Remove circleci configuration for integrations * Migrate common configuration to the root * Add publish step * Add badge * Add circleci image * Add circleci configuration
1 parent b141dcf commit 8939eba

File tree

41 files changed

+7100
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+7100
-613
lines changed

.circleci/config.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
version: 2
2+
jobs:
3+
setup:
4+
docker:
5+
- image: ${AWS_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/analytics.js-integrations-ci
6+
steps:
7+
- run:
8+
name: Checkout code
9+
command: checkout
10+
- restore_cache:
11+
key: deps-{{ checksum "yarn.lock" }}
12+
- run:
13+
name: Authenticate npm
14+
command: npm config set "//registry.npmjs.org/:_authToken" $NPM_AUTH
15+
- run:
16+
name: Install
17+
command: make install
18+
- save_cache:
19+
key: deps-{{ checksum "yarn.lock" }}
20+
paths:
21+
- node_modules
22+
- persist_to_workspace:
23+
root: .
24+
paths: [.]
25+
26+
test:
27+
docker:
28+
- image: ${AWS_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/analytics.js-integrations-ci
29+
steps:
30+
- attach_workspace: { at: . }
31+
- restore_cache:
32+
key: deps-{{ checksum "yarn.lock" }}
33+
- run:
34+
name: Run tests
35+
command: make test
36+
- store_artifacts:
37+
path: coverage
38+
- run:
39+
name: Run coverage
40+
command: make coverage
41+
42+
publish:
43+
docker:
44+
- image: ${AWS_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/analytics.js-integrations-ci
45+
steps:
46+
- attach_workspace: { at: . }
47+
- restore_cache:
48+
key: deps-{{ checksum "yarn.lock" }}
49+
- run:
50+
name: Publish updated packages
51+
command: make publish
52+
53+
workflows:
54+
version: 2
55+
test_and_publish:
56+
jobs:
57+
- setup
58+
- test:
59+
requires:
60+
- setup
61+
filters:
62+
tags:
63+
ignore: /.*/
64+
- publish:
65+
requires:
66+
- test
67+
filters:
68+
branches:
69+
only: master
File renamed without changes.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
operations/bin/
1+
bin/
2+
node_modules/
3+
coverage/

Makefile

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
ESLINT := node_modules/.bin/eslint
2+
KARMA := node_modules/.bin/karma
3+
CODECOV := node_modules/.bin/codecov
4+
OPERATIONS := $(wildcard operations/cmd/*)
5+
BINS := $(addprefix bin/,$(notdir $(OPERATIONS)))
6+
7+
export PATH := bin:$(PATH)
8+
9+
##
10+
# Program options/flags
11+
##
12+
13+
# A list of options to pass to Karma
14+
# Overriding this overwrites all options specified in this file (e.g. BROWSERS)
15+
KARMA_FLAGS ?=
16+
17+
# A list of Karma browser launchers to run
18+
# http://karma-runner.github.io/0.13/config/browsers.html
19+
BROWSERS ?=
20+
ifdef BROWSERS
21+
KARMA_FLAGS += --browsers $(BROWSERS)
22+
endif
23+
24+
ifdef CI
25+
KARMA_CONF ?= karma.conf.ci.js
26+
27+
else
28+
KARMA_CONF ?= karma.conf.js
29+
endif
30+
31+
ifndef CI
32+
OPERATIONS_PREFIX := bin/
33+
endif
34+
35+
# Mocha flags.
36+
GREP ?= .
37+
38+
# Install node modules.
39+
node_modules: package.json $(wildcard node_modules/*/package.json)
40+
yarn install
41+
touch $@
42+
43+
# Install dependencies.
44+
install: node_modules
45+
46+
# Remove temporary files and build artifacts.
47+
clean:
48+
rm -rf *.log coverage
49+
rm -f bin/*
50+
.PHONY: clean
51+
52+
coverage:
53+
$(CODECOV)
54+
.PHONY: coverage
55+
56+
# Remove temporary files, build artifacts, and vendor dependencies.
57+
distclean: clean
58+
rm -rf node_modules
59+
.PHONY: distclean
60+
61+
# Lint JavaScript source files.
62+
lint: install
63+
$(ESLINT) integrations/**/lib/ integrations/**/test/ integrations/**/karma*.js
64+
.PHONY: lint
65+
66+
# Attempt to fix linting errors.
67+
fmt: install
68+
$(ESLINT) --fix integrations/**/lib/ integrations/**/test/ integrations/**/karma*.js
69+
.PHONY: fmt
70+
71+
# Run browser unit tests in a browser.
72+
test: test-updated
73+
test-updated: install
74+
75+
# If we are in master, compare with the previous commit instead
76+
ifeq ($(shell git rev-parse --abbrev-ref HEAD),master)
77+
$(eval export INTEGRATIONS := $(shell $(OPERATIONS_PREFIX)list-updated-integrations --commit=$(shell git rev-parse --verify HEAD~)))
78+
else
79+
$(eval export INTEGRATIONS := $(shell $(OPERATIONS_PREFIX)list-updated-integrations))
80+
endif
81+
82+
$(KARMA) start $(KARMA_FLAGS) $(KARMA_CONF) --single-run;
83+
84+
test-all: install
85+
$(KARMA) start $(KARMA_FLAGS) $(KARMA_CONF) --single-run;
86+
87+
.PHONY: test test-updated test-all
88+
89+
# Publish updated integrations
90+
publish:
91+
@for integration in $(shell $(OPERATIONS_PREFIX)list-new-releases); do \
92+
npm publish integrations/$$integration; \
93+
done
94+
95+
.PHONY: publish
96+
97+
# Operations
98+
build-operations: $(BINS)
99+
100+
bin/%: operations/cmd/%/main.go
101+
govendor build -o $@ $<
102+
103+
docker-operations: build-operations
104+
docker build -f operations/ci/Dockerfile -t 528451384384.dkr.ecr.us-west-2.amazonaws.com/analytics.js-integrations-ci .
105+
docker push 528451384384.dkr.ecr.us-west-2.amazonaws.com/analytics.js-integrations-ciz
106+
107+
.PHONY: docker-operations build-operations

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
# analytics.js-integrations [![Build Status][ci-badge]][ci-link]
1+
[![Circle CI](https://ci.segment.com/gh/segmentio/analytics.js-integrations.svg?style=svg&circle-token=9ea127ae84700c7717d40e7f3ab2cb75a927292d)](https://ci.segment.com/gh/segmentio/analytics.js-integrations)
2+
# analytics.js-integrations
23

34
[Analytics.js][] integrations.
45

56
## License
67

78
Released under the [MIT license](LICENSE).
8-
9-
10-
[Analytics.js]: https://segment.com/docs/libraries/analytics.js/
11-
[ci-link]: https://circleci.com/gh/segment-integrations/analytics.js-integration-heap
12-
[ci-badge]: https://circleci.com/gh/segment-integrations/analytics.js-integration-heap.svg?style=svg

integrations/kenshoo-infinity/.circleci/config.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

integrations/kenshoo-infinity/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

integrations/kenshoo-infinity/Makefile

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)