Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
ci(test): Travis → Circle (#671)
Browse files Browse the repository at this point in the history
* ci(circle): add config file

* chore(nvm): consistent version

* chore(pkg): remove unused scripts & packages

* ci: remove unused scripts

* ci(circle): correct config

* ci: also run docs

* ci(circle): remove browser leftovers

* ci(circle): more fitting index name

* ci: replace travis build by circle build

* ci: simplify scripts

* remove utils.isCIBrowser

* Update scripts/build.sh

Co-Authored-By: Haroenv <fingebimus@me.com>

* ci(circle): change naming

* chore(ci): consistent naming
  • Loading branch information
Haroenv committed May 7, 2019
1 parent 522239c commit 76ff975
Show file tree
Hide file tree
Showing 25 changed files with 232 additions and 1,829 deletions.
75 changes: 75 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
aliases:
- &install_yarn_version
name: Install specific Yarn version
command: |
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2
echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV
- &restore_yarn_cache
name: Restore Yarn cache
keys:
- yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}

- &save_yarn_cache
name: Save Yarn cache
key: yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn

- &run_yarn_install
name: Install dependencies
command: yarn install

defaults: &defaults
working_directory: ~/algoliasearch-helper-js
docker:
- image: circleci/node:8.15.1@sha256:3d32b8457083c33c04eb60fac02c0e39de5bd28de4b95393d7dcb5aa37b20af7

version: 2
jobs:
build:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Build
command: yarn build

test:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Lint & Code styles
command: yarn lint
- run:
name: Unit & Integration Tests
command: yarn test --maxWorkers=4

docs:
<<: *defaults
steps:
- checkout
- run: *install_yarn_version
- restore_cache: *restore_yarn_cache
- run: *run_yarn_install
- save_cache: *save_yarn_cache
- run:
name: Build documentation
command: yarn doc

workflows:
version: 2
ci:
jobs:
- build
- test
- docs
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.9.0
8.15.1
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

18 changes: 2 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@
"scripts": {
"watch": "watchify index.js -v -s algoliasearchHelper -o dist/algoliasearch.helper.js",
"build": "./scripts/build.sh",
"dev": "DEBUG=zuul* zuul --no-coverage --local 8090 test/run.js",
"dev-coverage": "DEBUG=zuul* zuul --local 8090 test/run.js",
"lint": "scripts/lint.sh",
"lint": "eslint .",
"lint:watch": "onchange 'src/**/*js' 'index.js' 'test/**/*js' '.eslintrc' -- npm run -s lint",
"open": "sleep 1 && opn http://localhost:8080/examples",
"examples": "npm run build & npm run open & http-server .",
"doc": "gulp --gulpfile documentation-src/build.gulp.js doc",
"doc:watch": "gulp --gulpfile documentation-src/build.gulp.js doc:watch",
"doc:publish": "yarn run doc && gh-pages -d documentation",
"doc:staging": "scripts/staging-doc.sh",
"readme:toc": "doctoc --notitle README.md --maxlevel 3",
"test": "scripts/test.sh",
"test:ci": "scripts/test-ci.sh",
"test:unit": "jest",
"test:watch": "jest --watch",
"release": "git checkout dist/ && rm -rf node_modules && yarn && ./scripts/release.js",
Expand Down Expand Up @@ -47,13 +42,11 @@
"babel-loader": "6.4.1",
"babel-preset-es2015": "6.24.1",
"browserify": "14.5.0",
"browzers": "1.3.0",
"bulkify": "1.4.2",
"collect-json": "1.0.8",
"colors": "1.1.2",
"conventional-changelog-cli": "1.3.2",
"doctoc": "1.3.0",
"envify": "4.1.0",
"eslint": "1.10.3",
"eslint-config-airbnb": "0.0.8",
"eslint-config-algolia": "3.0.0",
Expand All @@ -64,7 +57,6 @@
"gulp-livereload": "3.8.1",
"gulp-sass": "2.3.2",
"handlebars": "4.1.0",
"http-server": "0.11.1",
"jest": "24.7.1",
"jest-watch-typeahead": "0.3.0",
"jsdoc-parse": "1.2.7",
Expand All @@ -83,25 +75,19 @@
"metalsmith-serve": "0.0.7",
"metalsmith-watch": "1.0.3",
"metalsmith-webpack": "1.0.3",
"mkdirp": "0.5.1",
"mversion": "1.13.0",
"onchange": "3.2.1",
"opn-cli": "3.1.0",
"pretty-bytes-cli": "2.0.0",
"prompt": "1.0.0",
"pug": "^2.0.3",
"replace-ext": "1.0.0",
"rimraf": "2.6.3",
"semver": "5.3.0",
"shelljs": "0.7.8",
"st": "1.2.2",
"uglify-js": "2.8.29",
"vinyl": "1.2.0",
"watchify": "3.7.0",
"webpack": "1.15.0",
"webpack-stream": "3.2.0",
"zuul": "3.11.1",
"zuul-ngrok": "4.0.0"
"webpack-stream": "3.2.0"
},
"dependencies": {
"events": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e # exit when error

[ -z $TRAVIS_BUILD_NUMBER ] && CI='false' || CI='true' || CI='true'
[ -z $CIRCLE_BUILD_NUM ] && CI='false' || CI='true'

if [ $CI == 'true' ]; then
set -x # debug messages
Expand Down
13 changes: 0 additions & 13 deletions scripts/lint.sh

This file was deleted.

14 changes: 0 additions & 14 deletions scripts/test-ci.sh

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/test-node.sh

This file was deleted.

10 changes: 2 additions & 8 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@

set -e # exit when error

[ -z $TRAVIS_BUILD_NUMBER ] && CI='false' || CI='true'
[ -z $CIRCLE_BUILD_NUM ] && CI='false' || CI='true'

if [ $CI == 'true' ]; then
set -x # debug messages
fi

echo "Test"

echo "Test: node"
./scripts/test-node.sh

echo "Test: lint"
./scripts/lint.sh
node test/run.js
1 change: 0 additions & 1 deletion test/ie8-polyfill.html

This file was deleted.

8 changes: 2 additions & 6 deletions test/integration-spec/helper.derive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ var algoliasearchHelper = require('../../');

var random = require('lodash/random');

if (!utils.shouldRun) {
test = test.skip;
}

test(
'[INT][DERIVE] Query the same index twice with different query',
function() {
var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_distinct.facet' + random(0, 5000);

return setup(indexName, function(client, index) {
Expand Down
10 changes: 3 additions & 7 deletions test/integration-spec/helper.distinct.facet.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
var utils = require('../integration-utils.js');
var setup = utils.setup;

var algoliasearchHelper = utils.isCIBrowser ? window.algoliasearchHelper : require('../../');
var algoliasearchHelper = require('../../');

var random = require('lodash/random');

if (!utils.shouldRun) {
test = test.skip;
}

test('[INT][FILTERS] Using distinct should let me retrieve all facet without distinct', function(done) {
var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_distinct.facet' + random(0, 5000);

setup(indexName, function(client, index) {
Expand Down
9 changes: 3 additions & 6 deletions test/integration-spec/helper.filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
var utils = require('../integration-utils.js');
var setup = utils.setup;

var algoliasearchHelper = utils.isCIBrowser ? window.algoliasearchHelper : require('../../');
var algoliasearchHelper = require('../../');

var random = require('lodash/random');

if (!utils.shouldRun) {
test = test.skip;
}

test('[INT][FILTERS] Should retrieve different values for multi facetted records', function(done) {
var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_refinements' + random(0, 5000);

setup(indexName, function(client, index) {
Expand Down
9 changes: 3 additions & 6 deletions test/integration-spec/helper.geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
var utils = require('../integration-utils.js');
var setup = utils.setupSimple;

var algoliasearchHelper = utils.isCIBrowser ? window.algoliasearchHelper : require('../../');
var algoliasearchHelper = require('../../');

var random = require('lodash/random');

if (!utils.shouldRun) {
test = test.skip;
}
var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_searchonce' + random(0, 5000);

var dataset = [
Expand Down
9 changes: 3 additions & 6 deletions test/integration-spec/helper.highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
var utils = require('../integration-utils.js');
var setup = utils.setup;

var algoliasearchHelper = utils.isCIBrowser ? window.algoliasearchHelper : require('../../');
var algoliasearchHelper = require('../../');

var random = require('lodash/random');

if (!utils.shouldRun) {
test = test.skip;
}

test('[INT][HIGHLIGHT] The highlight should be consistent with the parameters', function(done) {
var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_highlight' + random(0, 5000);

setup(indexName, function(client, index) {
Expand Down
9 changes: 3 additions & 6 deletions test/integration-spec/helper.insights.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
var utils = require('../integration-utils.js');
var setup = utils.setupSimple;

var algoliasearchHelper = utils.isCIBrowser ? window.algoliasearchHelper : require('../../');
var algoliasearchHelper = require('../../');

var random = require('lodash/random');

if (!utils.shouldRun) {
test = test.skip;
}

var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_searchonce' + random(0, 5000);

var dataset = [
Expand Down
14 changes: 5 additions & 9 deletions test/integration-spec/helper.numerics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@
var utils = require('../integration-utils.js');
var setup = utils.setup;

var algoliasearchHelper = utils.isCIBrowser ? window.algoliasearchHelper : require('../../');
var algoliasearchHelper = require('../../');

var random = require('lodash/random');
var map = require('lodash/map');

if (!utils.shouldRun) {
test = test.skip;
}

function hitsToParsedID(h) {
return parseInt(h.objectID, 10);
}

test('[INT][NUMERICS][RAW-API]Test numeric operations on the helper and their results on the algolia API',
function(done) {
var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_numerics' + random(0, 5000);

setup(indexName, function(client, index) {
Expand Down Expand Up @@ -87,8 +83,8 @@ test('[INT][NUMERICS][RAW-API]Test numeric operations on the helper and their re

test('[INT][NUMERICS][MANAGED-API]Test numeric operations on the helper and their results on the algolia API',
function(done) {
var indexName = '_travis-algoliasearch-helper-js-' +
(process.env.TRAVIS_BUILD_NUMBER || 'DEV') +
var indexName = '_circle-algoliasearch-helper-js-' +
(process.env.CIRCLE_BUILD_NUM || 'DEV') +
'helper_numerics_managed' + random(0, 5000);

setup(indexName, function(client, index) {
Expand Down
Loading

0 comments on commit 76ff975

Please sign in to comment.