Use travis build stages

Split each test target into a dedicated job, add docker build tests
This commit is contained in:
Łukasz Mierzwa
2017-12-03 14:28:51 -08:00
parent 52f0f42aa5
commit 336f74e48e
2 changed files with 41 additions and 17 deletions

View File

@@ -1,20 +1,44 @@
language: go
go:
- 1.9.x
go_import_path: github.com/cloudflare/unsee
cache:
directories:
- node_modules
- vendor
jobs:
include:
- stage: Test Go code
language: go
go: "1.9.2"
before_script:
- make mock-assets
cache:
directories:
- vendor
script: make test-go
env:
- NODE_ENV=test
- stage: Test JavaScript code
language: node_js
node_js: "8"
env:
- NODE_ENV=test
cache:
directories:
- node_modules
script: make test-js
before_script:
- nvm install 8
- stage: Lint Go code
language: go
go: "1.9.2"
script: make lint-go
script:
- make test
- stage: Lint JavaScript code
language: node_js
node_js: "8"
cache:
directories:
- node_modules
script: make lint-js
- stage: Build Docker image
sudo: true
addons:
apt:
packages:
- docker-ce
script: make docker-image

View File

@@ -103,9 +103,9 @@ lint: lint-go lint-js
# Creates mock bindata_assetfs.go with source assets rather than webpack generated ones
.PHONY: mock-assets
mock-assets: .build/deps.ok .build/vendor.ok
cp $(CURDIR)/assets/static/*.* $(CURDIR)/assets/static/dist/
mock-assets: .build/go-bindata .build/go-bindata-assetfs
mkdir -p $(CURDIR)/assets/static/dist/templates
cp $(CURDIR)/assets/static/*.* $(CURDIR)/assets/static/dist/
touch $(CURDIR)/assets/static/dist/templates/loader_unsee.html
touch $(CURDIR)/assets/static/dist/templates/loader_shared.html
touch $(CURDIR)/assets/static/dist/templates/loader_help.html