From 447d834b33e1546e4131ceaaf7ec703a13b97540 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Wed, 25 Mar 2020 17:46:06 +0900 Subject: [PATCH 1/6] ci: Add dev-image job --- .github/workflows/test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d7f240a9..e6b40e9b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,14 @@ jobs: steps: - run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" + dev-image: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - run: make build + - run: make run cmd="npm ci" + - run: make all + test: runs-on: ${{ matrix.os }} if: contains(github.event.head_commit.message, '[skip ci]') == false From a4e9f6880dae1bc6c9bc0a4153f0a263bc84c357 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Wed, 25 Mar 2020 17:55:46 +0900 Subject: [PATCH 2/6] ci: fix npm ci on docker --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6b40e9b8..2f5200667 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: steps: - uses: actions/checkout@v2 - run: make build - - run: make run cmd="npm ci" + - run: docker run --rm -v "${PWD}:/repo" -v ~/.gitconfig:/root/.gitconfig "actions_github_pages_dev:latest" npm ci - run: make all test: From 6ce14f32a4833c773c582987f1771cd5c26cdcf6 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Wed, 25 Mar 2020 18:11:35 +0900 Subject: [PATCH 3/6] ci: Add tasks for GitHub Actions --- .github/workflows/test.yml | 4 ++-- Makefile | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f5200667..ff66d0b21 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,8 +24,8 @@ jobs: steps: - uses: actions/checkout@v2 - run: make build - - run: docker run --rm -v "${PWD}:/repo" -v ~/.gitconfig:/root/.gitconfig "actions_github_pages_dev:latest" npm ci - - run: make all + - run: make cirun cmd="npm ci" + - run: make ciall test: runs-on: ${{ matrix.os }} diff --git a/Makefile b/Makefile index 79fac96a5..85323e661 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 -v ~/.gitconfig:/root/.gitconfig $(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 From 23dd6e86688dc6cd6a9197a7b087390d705e264d Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Wed, 25 Mar 2020 18:59:44 +0900 Subject: [PATCH 4/6] ci: split dev-image.yml --- .github/workflows/dev-image.yml | 34 +++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 8 -------- Makefile | 2 +- 3 files changed, 35 insertions(+), 9 deletions(-) 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 000000000..36dbfdd38 --- /dev/null +++ b/.github/workflows/dev-image.yml @@ -0,0 +1,34 @@ +name: 'Dev Image CI' + +on: + push: + branches: + - master + paths: + - '.dockerignore' + - '.nvmrc' + - 'Dockerfile' + - 'Makefile' + pull_request: + types: + - opened + - synchronize + paths: + - '.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 + steps: + - uses: actions/checkout@v2 + - run: make build + - run: make cirun cmd="npm ci" + - run: make ciall diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff66d0b21..7d7f240a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,14 +19,6 @@ jobs: steps: - run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}" - dev-image: - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - run: make build - - run: make cirun cmd="npm ci" - - run: make ciall - test: runs-on: ${{ matrix.os }} if: contains(github.event.head_commit.message, '[skip ci]') == false diff --git a/Makefile b/Makefile index 85323e661..90f1fd6bf 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +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 -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME) +DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME) .PHONY: build From 652f979431b04e2f902e492255f7acd5882c0221 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Wed, 25 Mar 2020 19:29:09 +0900 Subject: [PATCH 5/6] ci: update paths --- .github/workflows/dev-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dev-image.yml b/.github/workflows/dev-image.yml index 36dbfdd38..09298c8ed 100644 --- a/.github/workflows/dev-image.yml +++ b/.github/workflows/dev-image.yml @@ -5,6 +5,7 @@ on: branches: - master paths: + - '.github/workflows/dev-image.yml' - '.dockerignore' - '.nvmrc' - 'Dockerfile' @@ -14,6 +15,7 @@ on: - opened - synchronize paths: + - '.github/workflows/dev-image.yml' - '.dockerignore' - '.nvmrc' - 'Dockerfile' From 9211fe14bebb2c6b02654ffe8b5e5957b640b9d1 Mon Sep 17 00:00:00 2001 From: Shohei Ueda <30958501+peaceiris@users.noreply.github.com> Date: Wed, 25 Mar 2020 19:30:24 +0900 Subject: [PATCH 6/6] ci: add if for skip ci --- .github/workflows/dev-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev-image.yml b/.github/workflows/dev-image.yml index 09298c8ed..2a27412fb 100644 --- a/.github/workflows/dev-image.yml +++ b/.github/workflows/dev-image.yml @@ -29,6 +29,7 @@ jobs: 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