From 465b328f7559c99f1baf1b953e51031e9e95cb3c Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Wed, 25 Mar 2020 19:37:45 +0900 Subject: [PATCH] ci: Add dev-image workflow (#177) --- .github/workflows/dev-image.yml | 37 +++++++++++++++++++++++++++++++++ Makefile | 9 ++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/dev-image.yml diff --git a/.github/workflows/dev-image.yml b/.github/workflows/dev-image.yml new file mode 100644 index 0000000..2a27412 --- /dev/null +++ b/.github/workflows/dev-image.yml @@ -0,0 +1,37 @@ +name: 'Dev Image CI' + +on: + push: + branches: + - master + paths: + - '.github/workflows/dev-image.yml' + - '.dockerignore' + - '.nvmrc' + - 'Dockerfile' + - 'Makefile' + pull_request: + types: + - opened + - synchronize + paths: + - '.github/workflows/dev-image.yml' + - '.dockerignore' + - '.nvmrc' + - 'Dockerfile' + - 'Makefile' + +jobs: + skipci: + runs-on: ubuntu-18.04 + steps: + - run: echo "[skip ci] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" + + dev-image-test: + runs-on: ubuntu-18.04 + if: contains(github.event.head_commit.message, '[skip ci]') == false + steps: + - uses: actions/checkout@v2 + - run: make build + - run: make cirun cmd="npm ci" + - run: make ciall diff --git a/Makefile b/Makefile index 79fac96..90f1fd6 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ IMAGE_NAME := actions_github_pages_dev:latest NODE_VERSION := $(shell cat ./.nvmrc) 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_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME) .PHONY: build @@ -14,6 +15,10 @@ build: run: $(DOCKER_RUN) $(cmd) +.PHONY: cirun +cirun: + $(DOCKER_RUN_CI) $(cmd) + .PHONY: test test: $(DOCKER_RUN) npm test @@ -25,3 +30,7 @@ commit: .PHONY: all all: $(DOCKER_RUN) npm run all + +.PHONY: ciall +ciall: + $(DOCKER_RUN_CI) npm run all