274 lines
8.2 KiB
YAML
274 lines
8.2 KiB
YAML
name: 'Test'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- 'README.md'
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'README.md'
|
|
env:
|
|
# Use docker.io for Docker Hub if empty
|
|
REGISTRY: ghcr.io
|
|
# github.repository as <account>/<repo>
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
resolve-image-tag:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.regex-match.outputs.group1 }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Grep action.yaml content
|
|
id: grep-image-content
|
|
run: |
|
|
image=$(grep -E "jekyll-build-pages.*\'" action.yml)
|
|
echo "::set-output name=image::$image"
|
|
- uses: actions-ecosystem/action-regex-match@v2
|
|
id: regex-match
|
|
with:
|
|
text: ${{ steps.grep-image-content.outputs.image }}
|
|
regex: "jekyll-build-pages:(.*)'"
|
|
|
|
test-simple:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: simple
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-readme:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: readme
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-octicons:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: octicons
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-mojombo:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: mojombo
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-themes:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: themes
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-jekyll-include-cache:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: jekyll-include-cache
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-future-false:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: future-false
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-future-true:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TEST_NAME: future-true
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
|
|
- name: Test ${{ env.TEST_NAME }} Project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/${{ env.TEST_NAME }}
|
|
destination: ./test_projects/${{ env.TEST_NAME }}/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify output
|
|
run: |
|
|
./bin/compare_expected_output ./test_projects/${{env.TEST_NAME}}
|
|
|
|
test-runner-has-permission:
|
|
needs: resolve-image-tag
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build local docker image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
tags: ${{ needs.resolve-image-tag.outputs.tag }}
|
|
- name: Build simple project
|
|
uses: ./
|
|
with:
|
|
source: ./test_projects/simple
|
|
destination: ./test_projects/simple/_site
|
|
build_revision: JEKYLL_BUILD_REVISION
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Verify permissions on the build assets
|
|
run: |
|
|
if ! [[ -r ./test_projects/simple/_site/index.html ]]; then
|
|
echo '::error::Read permission is missing' && exit 1
|
|
fi
|
|
if ! [[ -w ./test_projects/simple/_site/index.html ]]; then
|
|
echo '::error::Write permission is missing' && exit 1
|
|
fi
|
|
shell: bash |