From 4ea9c3adaf70500861e5780d0eebe38ad2d9f0f6 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 15 Jun 2021 20:45:42 +0300 Subject: workflows/test -> workflows/ci --- .github/workflows/ci.yml | 173 +++++++++++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 173 --------------------------------------------- 2 files changed, 173 insertions(+), 173 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/test.yml (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..054aa7f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,173 @@ +name: This even works? + +on: + push: + pull_request: + schedule: + # Weekly, at 5:30 AM on Saturday (somewhat randomly chosen). + - cron: '30 5 * * 6' + workflow_dispatch: + +env: + JEKYLL_PROJECT_AUTHOR: egor-tensin + JEKYLL_PROJECT_NAME: egor-tensin.github.io + +jobs: + local_build: + runs-on: ubuntu-latest + name: Local build + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: src + - name: Checkout Jekyll project + uses: actions/checkout@v2 + with: + repository: ${{ env.JEKYLL_PROJECT_AUTHOR }}/${{ env.JEKYLL_PROJECT_NAME }} + path: ${{ env.JEKYLL_PROJECT_NAME }} + - name: Add ~/.local/bin to PATH + run: echo "$HOME/.local/bin" >> "$GITHUB_PATH" + - name: chruby & ruby-install are not installed + run: | + test '' = "$( type -t chruby-exec )" + test '' = "$( type -t ruby-install )" + - name: Install Ruby + run: | + cd src + make ruby-install + make ruby-install/clean + make ruby + make chruby + make chruby/clean + - name: chruby & ruby-install were installed + run: | + test 'file' = "$( type -t chruby-exec )" + test 'file' = "$( type -t ruby-install )" + - name: Install dependencies + run: | + cd src + make bundler + make dependencies "PROJECT_DIR=../$JEKYLL_PROJECT_NAME" + - name: _site doesn't exist + run: test ! -e "$JEKYLL_PROJECT_NAME/_site" + - name: Build Jekyll project + run: make -f src/Makefile jekyll/build "PROJECT_DIR=$JEKYLL_PROJECT_NAME" + - name: _site exists + run: | + test -d "$JEKYLL_PROJECT_NAME/_site" + test -f "$JEKYLL_PROJECT_NAME/_site/index.html" + docker_build: + runs-on: ubuntu-latest + name: Docker build + steps: + - name: Running as regular user + run: test "$( id -u )" != 0 + - name: Docker is accessible as regular user + run: docker ps + - name: Checkout + uses: actions/checkout@v2 + with: + path: src + - name: Checkout Jekyll project + uses: actions/checkout@v2 + with: + repository: ${{ env.JEKYLL_PROJECT_AUTHOR }}/${{ env.JEKYLL_PROJECT_NAME }} + path: ${{ env.JEKYLL_PROJECT_NAME }} + - name: Build Docker images + 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 + run: | + cd src + make docker/up "PROJECT_DIR=../$JEKYLL_PROJECT_NAME" + sleep 3 + make docker/logs + - 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" )" + test "$( id -u ) $( id -g )" = "$info" + - name: _site exists + run: | + test -d "$JEKYLL_PROJECT_NAME/_site" + test -f "$JEKYLL_PROJECT_NAME/_site/index.html" + - 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" )" + - name: Fetch index.html + run: curl -sS -D - http://localhost:4000/index.html + - name: _site/dummy.txt doesn't exist + run: test ! -e "$JEKYLL_PROJECT_NAME/_site/dummy.txt" + - name: create dummy.txt + run: | + echo 123 > "$JEKYLL_PROJECT_NAME/dummy.txt" + sleep 3 + - name: _site/dummy.txt exists + run: test -f "$JEKYLL_PROJECT_NAME/_site/dummy.txt" + - 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: make -f src/Makefile docker/down + docker_root_build: + runs-on: ubuntu-latest + name: Docker build (as root) + steps: + - name: Running as regular user + run: test "$( id -u )" != 0 + - name: sudo makes root + run: test "$( sudo id -u )" = 0 + - name: Checkout + uses: actions/checkout@v2 + with: + path: src + - name: Checkout Jekyll project + uses: actions/checkout@v2 + with: + repository: ${{ env.JEKYLL_PROJECT_AUTHOR }}/${{ env.JEKYLL_PROJECT_NAME }} + path: ${{ env.JEKYLL_PROJECT_NAME }} + - name: Jekyll project is owned by root + run: sudo chown -R -- root:root "$JEKYLL_PROJECT_NAME" + - name: Build Docker images + 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 + run: | + cd src + sudo make docker/up "PROJECT_DIR=../$JEKYLL_PROJECT_NAME" + sleep 3 + sudo make docker/logs + - name: Check Jekyll 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" )" + test '999 999' = "$info" + - name: _site exists + run: | + test -d "$JEKYLL_PROJECT_NAME/_site" + test -f "$JEKYLL_PROJECT_NAME/_site/index.html" + - 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" )" + - name: Fetch index.html + run: curl -sS -D - http://localhost:4000/index.html + - name: _site/dummy.txt doesn't exist + run: test ! -e "$JEKYLL_PROJECT_NAME/_site/dummy.txt" + - name: create dummy.txt + run: | + echo 123 | sudo tee "$JEKYLL_PROJECT_NAME/dummy.txt" + sleep 3 + - name: _site/dummy.txt exists + run: test -f "$JEKYLL_PROJECT_NAME/_site/dummy.txt" + - 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: sudo make -f src/Makefile docker/down diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 054aa7f..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,173 +0,0 @@ -name: This even works? - -on: - push: - pull_request: - schedule: - # Weekly, at 5:30 AM on Saturday (somewhat randomly chosen). - - cron: '30 5 * * 6' - workflow_dispatch: - -env: - JEKYLL_PROJECT_AUTHOR: egor-tensin - JEKYLL_PROJECT_NAME: egor-tensin.github.io - -jobs: - local_build: - runs-on: ubuntu-latest - name: Local build - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - path: src - - name: Checkout Jekyll project - uses: actions/checkout@v2 - with: - repository: ${{ env.JEKYLL_PROJECT_AUTHOR }}/${{ env.JEKYLL_PROJECT_NAME }} - path: ${{ env.JEKYLL_PROJECT_NAME }} - - name: Add ~/.local/bin to PATH - run: echo "$HOME/.local/bin" >> "$GITHUB_PATH" - - name: chruby & ruby-install are not installed - run: | - test '' = "$( type -t chruby-exec )" - test '' = "$( type -t ruby-install )" - - name: Install Ruby - run: | - cd src - make ruby-install - make ruby-install/clean - make ruby - make chruby - make chruby/clean - - name: chruby & ruby-install were installed - run: | - test 'file' = "$( type -t chruby-exec )" - test 'file' = "$( type -t ruby-install )" - - name: Install dependencies - run: | - cd src - make bundler - make dependencies "PROJECT_DIR=../$JEKYLL_PROJECT_NAME" - - name: _site doesn't exist - run: test ! -e "$JEKYLL_PROJECT_NAME/_site" - - name: Build Jekyll project - run: make -f src/Makefile jekyll/build "PROJECT_DIR=$JEKYLL_PROJECT_NAME" - - name: _site exists - run: | - test -d "$JEKYLL_PROJECT_NAME/_site" - test -f "$JEKYLL_PROJECT_NAME/_site/index.html" - docker_build: - runs-on: ubuntu-latest - name: Docker build - steps: - - name: Running as regular user - run: test "$( id -u )" != 0 - - name: Docker is accessible as regular user - run: docker ps - - name: Checkout - uses: actions/checkout@v2 - with: - path: src - - name: Checkout Jekyll project - uses: actions/checkout@v2 - with: - repository: ${{ env.JEKYLL_PROJECT_AUTHOR }}/${{ env.JEKYLL_PROJECT_NAME }} - path: ${{ env.JEKYLL_PROJECT_NAME }} - - name: Build Docker images - 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 - run: | - cd src - make docker/up "PROJECT_DIR=../$JEKYLL_PROJECT_NAME" - sleep 3 - make docker/logs - - 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" )" - test "$( id -u ) $( id -g )" = "$info" - - name: _site exists - run: | - test -d "$JEKYLL_PROJECT_NAME/_site" - test -f "$JEKYLL_PROJECT_NAME/_site/index.html" - - 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" )" - - name: Fetch index.html - run: curl -sS -D - http://localhost:4000/index.html - - name: _site/dummy.txt doesn't exist - run: test ! -e "$JEKYLL_PROJECT_NAME/_site/dummy.txt" - - name: create dummy.txt - run: | - echo 123 > "$JEKYLL_PROJECT_NAME/dummy.txt" - sleep 3 - - name: _site/dummy.txt exists - run: test -f "$JEKYLL_PROJECT_NAME/_site/dummy.txt" - - 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: make -f src/Makefile docker/down - docker_root_build: - runs-on: ubuntu-latest - name: Docker build (as root) - steps: - - name: Running as regular user - run: test "$( id -u )" != 0 - - name: sudo makes root - run: test "$( sudo id -u )" = 0 - - name: Checkout - uses: actions/checkout@v2 - with: - path: src - - name: Checkout Jekyll project - uses: actions/checkout@v2 - with: - repository: ${{ env.JEKYLL_PROJECT_AUTHOR }}/${{ env.JEKYLL_PROJECT_NAME }} - path: ${{ env.JEKYLL_PROJECT_NAME }} - - name: Jekyll project is owned by root - run: sudo chown -R -- root:root "$JEKYLL_PROJECT_NAME" - - name: Build Docker images - 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 - run: | - cd src - sudo make docker/up "PROJECT_DIR=../$JEKYLL_PROJECT_NAME" - sleep 3 - sudo make docker/logs - - name: Check Jekyll 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" )" - test '999 999' = "$info" - - name: _site exists - run: | - test -d "$JEKYLL_PROJECT_NAME/_site" - test -f "$JEKYLL_PROJECT_NAME/_site/index.html" - - 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" )" - - name: Fetch index.html - run: curl -sS -D - http://localhost:4000/index.html - - name: _site/dummy.txt doesn't exist - run: test ! -e "$JEKYLL_PROJECT_NAME/_site/dummy.txt" - - name: create dummy.txt - run: | - echo 123 | sudo tee "$JEKYLL_PROJECT_NAME/dummy.txt" - sleep 3 - - name: _site/dummy.txt exists - run: test -f "$JEKYLL_PROJECT_NAME/_site/dummy.txt" - - 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: sudo make -f src/Makefile docker/down -- cgit v1.2.3