ci: Add task for CI

This commit is contained in:
peaceiris 2020-03-27 18:07:37 +09:00
parent 0ac5822f71
commit f5ec9e9038
3 changed files with 17 additions and 4 deletions

View file

@ -33,5 +33,5 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: make build - run: make build
#- run: make cirun cmd="npm ci" - run: make cirun cmd="npm ci"
#- run: make ciall - run: make ciall

View file

@ -4,6 +4,7 @@ IMAGE_NAME := actions_hugo_dev:latest
NODE_VERSION := $(shell cat ./.nvmrc) NODE_VERSION := $(shell cat ./.nvmrc)
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION) DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME) DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
.PHONY: build .PHONY: build
@ -14,6 +15,10 @@ build:
run: run:
$(DOCKER_RUN) $(cmd) $(DOCKER_RUN) $(cmd)
.PHONY: cirun
cirun:
$(DOCKER_RUN_CI) $(cmd)
.PHONY: test .PHONY: test
test: test:
$(DOCKER_RUN) npm test $(DOCKER_RUN) npm test
@ -21,3 +26,11 @@ test:
.PHONY: commit .PHONY: commit
commit: commit:
$(DOCKER_RUN) git commit -m "$(msg)" $(DOCKER_RUN) git commit -m "$(msg)"
.PHONY: all
all:
$(DOCKER_RUN) npm run all
.PHONY: ciall
ciall:
$(DOCKER_RUN_CI) npm run all

View file

@ -8,6 +8,7 @@
"npm": ">=6.13.7" "npm": ">=6.13.7"
}, },
"scripts": { "scripts": {
"all": "npm run format:check && npm run lint && npm test",
"lint": "eslint ./{src,__tests__}/**/*.ts", "lint": "eslint ./{src,__tests__}/**/*.ts",
"lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts", "lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts",
"test": "jest --coverage --verbose", "test": "jest --coverage --verbose",
@ -28,8 +29,7 @@
"lint-staged": { "lint-staged": {
"src/**/*.ts": [ "src/**/*.ts": [
"prettier --check", "prettier --check",
"eslint", "eslint"
"jest --bail --findRelatedTests"
] ]
}, },
"repository": { "repository": {