aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-05-06 23:21:23 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-05-06 23:42:52 +0300
commit46d8b325feda8745476c957a74fe605e15c675f4 (patch)
tree6d75e83157a61b20cba01a0e0ba0d4563b70cfcc
parentfix GitHub action tests (diff)
downloadjekyll-docker-46d8b325feda8745476c957a74fe605e15c675f4.tar.gz
jekyll-docker-46d8b325feda8745476c957a74fe605e15c675f4.zip
workflows/test.yml: better step names & linting
Diffstat (limited to '')
-rw-r--r--.github/workflows/test.yml41
-rw-r--r--Makefile4
2 files changed, 15 insertions, 30 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index f0590a0..4faf45c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -44,18 +44,13 @@ jobs:
make bundler
make dependencies "PROJECT_DIR=../$JEKYLL_PROJECT_NAME"
- name: _site doesn't exist
- run: |
- cd -- "$JEKYLL_PROJECT_NAME"
- test ! -e '_site'
+ run: test ! -e "$JEKYLL_PROJECT_NAME/_site"
- name: Build Jekyll project
- run: |
- cd src
- make jekyll/build "PROJECT_DIR=../$JEKYLL_PROJECT_NAME"
+ run: make -f src/Makefile jekyll/build "PROJECT_DIR=$JEKYLL_PROJECT_NAME"
- name: _site exists
run: |
- cd -- "$JEKYLL_PROJECT_NAME"
- test -d '_site'
- test -f '_site/index.html'
+ test -d "$JEKYLL_PROJECT_NAME/_site"
+ test -f "$JEKYLL_PROJECT_NAME/_site/index.html"
docker_build:
name: Docker build
runs-on: ubuntu-18.04
@@ -74,9 +69,7 @@ jobs:
repository: ${{ env.JEKYLL_PROJECT_AUTHOR }}/${{ env.JEKYLL_PROJECT_NAME }}
path: ${{ env.JEKYLL_PROJECT_NAME }}
- name: Build Docker images
- run: |
- cd src
- make docker/build "PROJECT_DIR=../$JEKYLL_PROJECT_NAME"
+ run: make -f src/Makefile docker/build "PROJECT_DIR=$JEKYLL_PROJECT_NAME"
- name: _site doesn't exist
run: test ! -e "$JEKYLL_PROJECT_NAME/_site"
- name: Start containers
@@ -85,7 +78,7 @@ jobs:
make docker/up "PROJECT_DIR=../$JEKYLL_PROJECT_NAME"
sleep 3
make docker/logs
- - name: Check container UID
+ - name: Check Jekyll running as current user
run: |
pid="$( docker inspect -f '{{.State.Pid}}' jekyll_project_1 )"
info="$( ps --no-headers -o uid:1,gid:1 -p "$pid" )"
@@ -94,7 +87,7 @@ jobs:
run: |
test -d "$JEKYLL_PROJECT_NAME/_site"
test -f "$JEKYLL_PROJECT_NAME/_site/index.html"
- - name: Check _site ownership
+ - name: Check _site owned by current user
run: |
test "$( id -u ) $( id -g )" = "$( stat -c '%u %g' "$JEKYLL_PROJECT_NAME/_site" )"
test "$( id -u ) $( id -g )" = "$( stat -c '%u %g' "$JEKYLL_PROJECT_NAME/_site/index.html" )"
@@ -108,14 +101,12 @@ jobs:
sleep 3
- name: _site/dummy.txt exists
run: test -f "$JEKYLL_PROJECT_NAME/_site/dummy.txt"
- - name: Check _site/dummy.txt ownership
+ - name: Check _site/dummy.txt owned by current user
run: test "$( id -u ) $( id -g )" = "$( stat -c '%u %g' "$JEKYLL_PROJECT_NAME/_site/dummy.txt" )"
- name: Fetch dummy.txt
run: curl -sS -D - http://localhost:4000/dummy.txt
- name: Stop containers
- run: |
- cd src
- make docker/down
+ run: make -f src/Makefile docker/down
docker_root_build:
name: Docker build (as root)
runs-on: ubuntu-18.04
@@ -136,9 +127,7 @@ jobs:
- name: Jekyll project is owned by root
run: sudo chown -R -- root:root "$JEKYLL_PROJECT_NAME"
- name: Build Docker images
- run: |
- cd src
- sudo make docker/build "PROJECT_DIR=../$JEKYLL_PROJECT_NAME"
+ run: sudo make -f src/Makefile docker/build "PROJECT_DIR=$JEKYLL_PROJECT_NAME"
- name: _site doesn't exist
run: test ! -e "$JEKYLL_PROJECT_NAME/_site"
- name: Start containers
@@ -147,7 +136,7 @@ jobs:
sudo make docker/up "PROJECT_DIR=../$JEKYLL_PROJECT_NAME"
sleep 3
sudo make docker/logs
- - name: Check container UID
+ - name: Check container running as container user
run: |
pid="$( docker inspect -f '{{.State.Pid}}' jekyll_project_1 )"
info="$( ps --no-headers -o uid:1,gid:1 -p "$pid" )"
@@ -156,7 +145,7 @@ jobs:
run: |
test -d "$JEKYLL_PROJECT_NAME/_site"
test -f "$JEKYLL_PROJECT_NAME/_site/index.html"
- - name: Check _site ownership
+ - name: Check _site owned by container user
run: |
test '999 999' = "$( stat -c '%u %g' "$JEKYLL_PROJECT_NAME/_site" )"
test '999 999' = "$( stat -c '%u %g' "$JEKYLL_PROJECT_NAME/_site/index.html" )"
@@ -170,11 +159,9 @@ jobs:
sleep 3
- name: _site/dummy.txt exists
run: test -f "$JEKYLL_PROJECT_NAME/_site/dummy.txt"
- - name: Check _site/dummy.txt ownership
+ - name: Check _site/dummy.txt owned by container user
run: test '999 999' = "$( stat -c '%u %g' "$JEKYLL_PROJECT_NAME/_site/dummy.txt" )"
- name: Fetch dummy.txt
run: curl -sS -D - http://localhost:4000/dummy.txt
- name: Stop containers
- run: |
- cd src
- sudo make docker/down
+ run: sudo make -f src/Makefile docker/down
diff --git a/Makefile b/Makefile
index fe2a34f..44b9211 100644
--- a/Makefile
+++ b/Makefile
@@ -111,9 +111,7 @@ JEKYLL_UID ?= $(shell id -u)
JEKYLL_GID ?= $(shell id -g)
export JEKYLL_UID JEKYLL_GID
-# Not an absolute path, cause you know, Windows (more specifically, Cygwin +
-# native Windows docker-compose).
-docker_compose := cd -- '$(makefile_dir)' && docker-compose --env-file ./.env
+docker_compose := cd -- '$(makefile_dir)' && PROJECT_DIR='$(abspath $(PROJECT_DIR))' docker-compose --env-file ./.env
.PHONY: docker/build
docker/build: