feat(ci): ensure golang/nodejs versions are consistent

This commit is contained in:
Łukasz Mierzwa
2020-01-10 18:44:17 +00:00
parent fa727427ff
commit e52355ff7d
2 changed files with 36 additions and 1 deletions

View File

@@ -124,6 +124,18 @@ jobs:
- travis_retry make openapi-client
- git diff --exit-code
- stage: Lint
name: Lint Golang Version
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
language: shell
script: make lint-golang-version
- stage: Lint
name: Lint Node Version
if: (repo = prymitive/karma AND type != pull_request) OR (fork = true AND type = pull_request)
language: shell
script: make lint-nodejs-version
- stage: Snapshots
name: Percy UI snapshots
if: (repo = prymitive/karma AND type != pull_request AND type != cron) OR (fork = true AND type = pull_request)

View File

@@ -135,8 +135,31 @@ lint-js: .build/deps-build-node.ok
lint-docs: .build/deps-build-node.ok
$(CURDIR)/ui/node_modules/.bin/markdownlint *.md docs
.PHONY: lint-golang-version
lint-golang-version:
$(eval CI_VERSION := $(shell grep -E '^(\ +)go:' .travis.yml | awk '{print $$2}' | tr -d "'\""))
$(eval BUILD_VERSION := $(shell grep -E '^FROM golang:' Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
$(eval DEMO_VERSION := $(shell grep -E '^FROM golang:' demo/Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
@if [ "$(CI_VERSION)" != "$(BUILD_VERSION)" ] || [ "$(CI_VERSION)" != "$(DEMO_VERSION)" ] || [ "$(BUILD_VERSION)" != "$(DEMO_VERSION)" ]; then \
echo "Golang version mismatch: CI_VERSION=$(CI_VERSION) BUILD_VERSION=$(BUILD_VERSION) DEMO_VERSION=$(DEMO_VERSION)"; \
exit 1; \
fi
.PHONY: lint-nodejs-version
lint-nodejs-version:
$(eval CI_VERSION := $(shell cat .nvmrc))
$(eval BUILD_VERSION := $(shell grep -E '^FROM node:' Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
$(eval DEMO_VERSION := $(shell grep -E '^FROM node:' demo/Dockerfile | cut -d : -f 2 | awk '{print $1}' | cut -d '-' -f 1))
@if [ "$(CI_VERSION)" != "$(BUILD_VERSION)" ] || [ "$(CI_VERSION)" != "$(DEMO_VERSION)" ] || [ "$(BUILD_VERSION)" != "$(DEMO_VERSION)" ]; then \
echo "Node version mismatch: CI_VERSION=$(CI_VERSION) BUILD_VERSION=$(BUILD_VERSION) DEMO_VERSION=$(DEMO_VERSION)"; \
exit 1; \
fi
.PHONY: lint-versions
lint-versions: lint-golang-version lint-nodejs-version
.PHONY: lint
lint: lint-go lint-js lint-docs
lint: lint-go lint-js lint-docs lint-versions
.PHONY: benchmark-go
benchmark-go: