Skip to content

Bump swedbank-pay-design-guide-jekyll-theme from 2.1.11 to 2.1.13 in /tests/full #3064

Bump swedbank-pay-design-guide-jekyll-theme from 2.1.11 to 2.1.13 in /tests/full

Bump swedbank-pay-design-guide-jekyll-theme from 2.1.11 to 2.1.13 in /tests/full #3064

Workflow file for this run

name: Test
on: [push, pull_request, pull_request_target]
jobs:
variables:
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.variables.outputs.ref }}
sha: ${{ steps.variables.outputs.sha }}
sha8: ${{ steps.variables.outputs.sha8 }}
date: ${{ steps.variables.outputs.date }}
version: ${{ steps.variables.outputs.version }}
build_branch: ${{ steps.variables.outputs.build_branch }}
deploy_branch: ${{ steps.variables.outputs.deploy_branch }}
ghpr_docker_image_fqn: ${{ steps.variables.outputs.ghpr_docker_image_fqn }}
ghpr_docker_image_tag: ${{ steps.variables.outputs.docker_image_tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gittools/actions/gitversion/setup@v0.10.2
with:
versionSpec: "5.x.x"
- id: gitversion
uses: gittools/actions/gitversion/execute@v0.10.2
- id: variables
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: ./.github/scripts/variables.sh ${{ steps.gitversion.outputs.fullSemVer }}
hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: github-pr-review
if_false: github-check
- uses: reviewdog/action-hadolint@v1
with:
fail_on_error: true
level: warning
reporter: ${{ steps.reporter.outputs.value }}
verify-bash:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: ShellCheck
uses: bewuethr/shellcheck-action@v2
- name: Control Character Check
run: ./.github/scripts/control_character_finder.sh
docker-build:
runs-on: ubuntu-latest
needs: variables
# If the PR is coming from a fork (pull_request_target), ensure it's opened by "dependabot[bot]".
# Otherwise, clone it normally.
if: |
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]') ||
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]')
steps:
- uses: actions/checkout@v4
if: ${{ github.event_name != 'pull_request_target' }}
- uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request_target' }}
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Build Docker Image
uses: whoan/docker-build-with-cache-action@v8.0.0
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
image_name: jekyll-plantuml
image_tag: ${{ needs.variables.outputs.sha8 }}
dockerfile: .docker/Dockerfile
push_image_and_stages: true
pull_image_and_stages: true
build_extra_args: --build-arg SHA=${{ needs.variables.outputs.sha }} --build-arg TAG=${{ needs.variables.outputs.sha8 }} --build-arg DATE=${{ needs.variables.outputs.date }} --build-arg VERSION=${{ needs.variables.outputs.version }}
test-serve:
runs-on: ubuntu-latest
needs: [variables, docker-build]
steps:
- uses: actions/checkout@v4
- name: Run Docker Image (serve)
run: |
timeout --preserve-status 10m \
./.github/scripts/docker_run_test.sh \
serve \
--image ${{ needs.variables.outputs.ghpr_docker_image_fqn }} \
--image-tag ${{ needs.variables.outputs.ghpr_docker_image_tag }} \
--repository ${{ github.repository }} \
--dir ${{ github.workspace }}/tests/full \
--token ${{ secrets.GITHUB_TOKEN }} \
--verbose
test-serve-no-gemfile:
runs-on: ubuntu-latest
needs: [variables, docker-build]
steps:
- uses: actions/checkout@v4
- name: Run Docker Image (serve, no Gemfile)
run: |
timeout --preserve-status 10m \
./.github/scripts/docker_run_test.sh \
serve \
--image ${{ needs.variables.outputs.ghpr_docker_image_fqn }} \
--image-tag ${{ needs.variables.outputs.ghpr_docker_image_tag }} \
--repository ${{ github.repository }} \
--dir ${{ github.workspace }}/tests/minimal \
--token ${{ secrets.GITHUB_TOKEN }} \
--verbose
test-build:
runs-on: ubuntu-latest
needs: [variables, docker-build]
steps:
- uses: actions/checkout@v4
- name: Run Docker Image (build)
run: |
./.github/scripts/docker_run_test.sh \
build \
--image ${{ needs.variables.outputs.ghpr_docker_image_fqn }} \
--image-tag ${{ needs.variables.outputs.ghpr_docker_image_tag }} \
--repository ${{ github.repository }} \
--dir ${{ github.workspace }}/tests/full \
--token ${{ secrets.GITHUB_TOKEN }} \
--verbose
test-build-no-gemfile:
runs-on: ubuntu-latest
needs: [variables, docker-build]
steps:
- uses: actions/checkout@v4
- name: Run Docker Image (build, no Gemfile)
run: |
./.github/scripts/docker_run_test.sh \
build \
--image ${{ needs.variables.outputs.ghpr_docker_image_fqn }} \
--image-tag ${{ needs.variables.outputs.ghpr_docker_image_tag }} \
--repository ${{ github.repository }} \
--dir ${{ github.workspace }}/tests/minimal \
--token ${{ secrets.GITHUB_TOKEN }} \
--verbose
test-build-gemspec:
runs-on: ubuntu-latest
needs: [variables, docker-build]
steps:
- uses: actions/checkout@v4
- name: Run Docker Image (build with gemspec)
run: |
./.github/scripts/docker_run_test.sh \
build \
--image ${{ needs.variables.outputs.ghpr_docker_image_fqn }} \
--image-tag ${{ needs.variables.outputs.ghpr_docker_image_tag }} \
--repository ${{ github.repository }} \
--dir ${{ github.workspace }}/tests/gemspec \
--token ${{ secrets.GITHUB_TOKEN }} \
--verbose
rspec:
runs-on: ubuntu-latest
env:
working-directory: .docker/entrypoint
defaults:
run:
working-directory: ${{ env.working-directory }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
working-directory: ${{ env.working-directory }}
- run: bundle exec rake
- name: codecov
run: bundle exec rake codecov:upload || echo 'Codecov upload failed'
- name: rubocop
run: bundle exec rubocop --fail-level warning --display-only-fail-level-offenses
verify-output:
runs-on: ubuntu-latest
needs: [variables, docker-build]
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Verify build output
env:
IMAGE_FQN: docker.pkg.github.com/swedbankpay/jekyll-plantuml-docker/jekyll-plantuml:${{ needs.variables.outputs.sha8 }}
run: |
docker login https://docker.pkg.github.com -u ${{ github.repository_owner }} -p "${{ secrets.GITHUB_TOKEN }}"
docker pull "${IMAGE_FQN}"
docker run \
--volume $(pwd)/tests/full:/srv/jekyll \
--env DEBUG=true \
--env GITHUB_BRANCH=${{ needs.variables.outputs.build_branch }} \
--env GITHUB_REPOSITORY_URL=${{ github.event.repository.html_url }} \
"${IMAGE_FQN}" \
build \
--verify \
--env=production \
--log-level=debug \
--site-url=https://example.com/ \
--ignore-url '%r{[/.]?page1}' \
--ignore-url http://www.wikipedia.org \
--ignore-url '%r{https://github.com/SwedbankPay/jekyll-plantuml-docker/tree/.*}' \
--ignore-url https://example.com/link.html
- name: Verify site URL
run: grep 'https://example.com/' ${{ github.workspace }}/tests/full/_site/index.html
- name: Verify GitHub repository URL
run: grep '${{ github.event.repository.html_url }}' ${{ github.workspace }}/tests/full/_site/index.html
- name: Upload build output artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: verify-output-verify-html
path: tests/full/_site/*.html
- name: Build
env:
IMAGE_FQN: docker.pkg.github.com/swedbankpay/jekyll-plantuml-docker/jekyll-plantuml:${{ needs.variables.outputs.sha8 }}
run: |
docker login https://docker.pkg.github.com -u ${{ github.repository_owner }} -p "${{ secrets.GITHUB_TOKEN }}"
docker pull "${IMAGE_FQN}"
docker run \
--volume $(pwd)/tests/full:/srv/jekyll \
--env DEBUG=true \
--env GITHUB_BRANCH=${{ needs.variables.outputs.build_branch }} \
--env GITHUB_REPOSITORY_URL=${{ github.event.repository.html_url }} \
"${IMAGE_FQN}" \
build \
--env=production \
--log-level=debug \
--site-url=https://swedbankpay.github.io/jekyll-plantuml-docker/
- name: Verify base URL
run: grep 'https://swedbankpay.github.io/jekyll-plantuml-docker/' ${{ github.workspace }}/tests/full/_site/index.html
- name: Upload build output artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: verify-output-build-html
path: tests/full/_site/*.html
test-deploy:
runs-on: ubuntu-latest
needs: [variables, docker-build]
steps:
- uses: actions/checkout@v4
- name: Test Deploy
env:
SHA8: ${{ needs.variables.outputs.sha8 }}
WORK_DIR: ${{ github.workspace }}
GIT_DEPLOY_DIR: _site
GIT_DEPLOY_BRANCH: ${{ needs.variables.outputs.deploy_branch }}
GIT_DEPLOY_REPO: https://${{ secrets.GH_PAGES_TOKEN }}@github.com/${{ github.repository }}.git
IMAGE_TAG: ${{ needs.variables.outputs.sha8 }}
IMAGE_NAME: docker.pkg.github.com/swedbankpay/jekyll-plantuml-docker/jekyll-plantuml
run: |
docker login https://docker.pkg.github.com -u ${{ github.repository_owner }} -p "${{ secrets.GITHUB_TOKEN }}"
docker pull ${IMAGE_NAME}:${IMAGE_TAG}
docker run \
--volume ${WORK_DIR}/tests/minimal:/srv/jekyll \
--env GIT_DEPLOY_DIR="${GIT_DEPLOY_DIR}" \
--env GIT_DEPLOY_BRANCH="${GIT_DEPLOY_BRANCH}" \
--env GIT_DEPLOY_REPO="${GIT_DEPLOY_REPO}" \
--env PAGES_REPO_NWO="${{ github.repository }}" \
--env JEKYLL_GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" \
--env DEBUG="true" \
${IMAGE_NAME}:${IMAGE_TAG} \
deploy \
--env=production \
--log-level=debug
cleanup:
runs-on: ubuntu-latest
needs: [test-deploy, variables]
if: always()
steps:
- uses: actions/checkout@v4
- name: Cleanup
if: always()
run: .github/scripts/cleanup.sh --branch ${{ needs.variables.outputs.deploy_branch }} --commit ${{ github.sha }} --remote --verbose