diff --git a/.circleci/config.yml b/.circleci/config.yml index db81d912..ea4d3f04 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,8 +3,39 @@ version: 2.1 orbs: prometheus: prometheus/prometheus@0.1.0 + go: circleci/go@0.2.0 jobs: + test_frontend: + # We need to use a machine executor because the front-end validation runs + # containers with mounted volumes which isn't supported with the docker + # executor (even with setup_remote_docker). + machine: true + steps: + - checkout + - run: sudo service docker restart + - run: + name: Remove existing Go installation + command: sudo rm -rf /usr/local/go + # Whenever the Go version is updated here, .travis.yml and .promu.yml + # should also be updated. + - go/install: + version: "1.12.9" + - run: + name: Remove generated code + command: make clean + - run: + name: Generate front-end code + command: make all + working_directory: ~/project/ui/app + - run: + name: Generate assets + command: make assets + - run: + name: Generate API v2 code + command: make apiv2 + - run: git diff --exit-code + test: docker: # Whenever the Go version is updated here, .travis.yml and .promu.yml @@ -59,10 +90,15 @@ jobs: - prometheus/store_artifact: file: amtool + workflows: version: 2 alertmanager: jobs: + - test_frontend: + filters: + tags: + only: /.*/ - test: filters: tags: @@ -75,6 +111,7 @@ workflows: - prometheus/publish_master: context: org-context requires: + - test_frontend - test - build filters: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 033d692d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: false -language: go -go_import_path: github.com/prometheus/alertmanager - -services: -- docker - -# Whenever the Go version is updated here, .circleci/config.yml and .promu.yml -# should also be updated. -go: -- 1.12.x - -script: -# test front-end -- make clean -- cd ui/app/ && make && cd ../.. -- make assets apiv2 -- git diff --exit-code -# test back-end -- make -- git diff --exit-code diff --git a/Makefile b/Makefile index ce66c7dd..57644c86 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,11 @@ STATICCHECK_IGNORE = # Will build both the front-end as well as the back-end build-all: assets apiv2 build -assets: ui/app/script.js ui/app/index.html ui/app/lib template/default.tmpl - GO111MODULE=$(GO111MODULE) $(GO) generate ./asset +.PHONY: assets +assets: asset/assets_vfsdata.go + +asset/assets_vfsdata.go: ui/app/script.js ui/app/index.html ui/app/lib template/default.tmpl + GO111MODULE=$(GO111MODULE) $(GO) generate $(GOOPTS) ./asset @$(GOFMT) -w ./asset ui/app/script.js: $(shell find ui/app/src -iname *.elm) api/v2/openapi.yaml diff --git a/asset/doc.go b/asset/doc.go index 3aa1e678..386c8cca 100644 --- a/asset/doc.go +++ b/asset/doc.go @@ -15,7 +15,7 @@ package asset import ( - // The blank import is to make govendor happy. + // The blank import is to make go modules happy. _ "github.com/shurcooL/vfsgen" )