mirror of https://github.com/escalate/hugo-split-theme.git

Felix Boerner
08.48.2024 ea89892920e7830fd397d3b50a73b27a34f6a892
test: add workflow
10 files copied
2 files deleted
8 files added
10 files renamed
1 files modified
546 ■■■■ changed files
.github/workflows/ci.yml 48 ●●●●● patch | view | raw | blame | history
.github/workflows/peformance.yml 65 ●●●●● patch | view | raw | blame | history
.github/workflows/release.yml 57 ●●●●● patch | view | raw | blame | history
.github/workflows/tests.yml 274 ●●●●● patch | view | raw | blame | history
.gitignore 2 ●●●●● patch | view | raw | blame | history
.yamllint 9 ●●●●● patch | view | raw | blame | history
lighthouserc.json 7 ●●●●● patch | view | raw | blame | history
tests/exampleSiteWithImage/budget.json 18 ●●●●● patch | view | raw | blame | history
tests/exampleSiteWithImage/config.toml 2 ●●● patch | view | raw | blame | history
tests/exampleSiteWithImage/content/_index.md patch | view | raw | blame | history
tests/exampleSiteWithImage/content/ipsum-in.md patch | view | raw | blame | history
tests/exampleSiteWithImage/content/luctus-urna.md patch | view | raw | blame | history
tests/exampleSiteWithImage/content/purus-sem.md patch | view | raw | blame | history
tests/exampleSiteWithImage/docker-compose.yml 20 ●●●●● patch | view | raw | blame | history
tests/exampleSiteWithImage/static/css/style.css patch | view | raw | blame | history
tests/exampleSiteWithImage/static/favicon.ico patch | view | raw | blame | history
tests/exampleSiteWithImage/static/images/background.jpg patch | view | raw | blame | history
tests/exampleSiteWithImage/static/images/social.jpg patch | view | raw | blame | history
tests/exampleSiteWithImage/static/videos/background.mp4 patch | view | raw | blame | history
tests/exampleSiteWithVideo/budget.json 18 ●●●●● patch | view | raw | blame | history
tests/exampleSiteWithVideo/config.toml 6 ●●●● patch | view | raw | blame | history
tests/exampleSiteWithVideo/content/_index.md patch | view | raw | blame | history
tests/exampleSiteWithVideo/content/ipsum-in.md patch | view | raw | blame | history
tests/exampleSiteWithVideo/content/luctus-urna.md patch | view | raw | blame | history
tests/exampleSiteWithVideo/content/purus-sem.md patch | view | raw | blame | history
tests/exampleSiteWithVideo/docker-compose.yml 20 ●●●●● patch | view | raw | blame | history
tests/exampleSiteWithVideo/static/css/style.css patch | view | raw | blame | history
tests/exampleSiteWithVideo/static/favicon.ico patch | view | raw | blame | history
tests/exampleSiteWithVideo/static/images/background.jpg patch | view | raw | blame | history
tests/exampleSiteWithVideo/static/images/social.jpg patch | view | raw | blame | history
tests/exampleSiteWithVideo/static/videos/background.mp4 patch | view | raw | blame | history
.github/workflows/ci.yml
File was deleted
.github/workflows/peformance.yml
New file
@@ -0,0 +1,65 @@
name: Web-Performance
'on':
  push:
    branches:
      - master
  pull_request:
jobs:
  hugo:
    name: Hugo
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
      - name: Build Hugo example site with image
        run: |
          cd tests/exampleSiteWithImage/
          hugo --logLevel=info --baseURL= --themesDir=../../../
      - name: Upload Hugo example site with image
        uses: actions/upload-artifact@v4
        with:
          name: hugo-example-site-with-image
          path: tests/exampleSiteWithImage/public
      - name: Build Hugo example site with video
        run: |
          cd tests/exampleSiteWithVideo/
          hugo --logLevel=info --baseURL= --themesDir=../../../
      - name: Upload Hugo example site with video
        uses: actions/upload-artifact@v4
        with:
          name: hugo-example-site-with-video
          path: tests/exampleSiteWithVideo/public
  sitespeed:
    name: Sitespeed.io
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Run sitespeed.io for example site with image
        run: |
          docker compose --file tests/exampleSiteWithImage/docker-compose.yml up --exit-code-from sitespeed
      - name: Upload sitespeed.io result for example site with image
        uses: actions/upload-artifact@v4
        with:
          name: sitespeed.io-example-site-with-image
          path: tests/exampleSiteWithImage/sitespeed-result
      - name: Run sitespeed.io for example site with video
        run: |
          docker compose --file tests/exampleSiteWithVideo/docker-compose.yml up --exit-code-from sitespeed
      - name: Upload sitespeed.io result for example site with video
        uses: actions/upload-artifact@v4
        with:
          name: sitespeed.io-example-site-with-video
          path: tests/exampleSiteWithVideo/sitespeed-result
.github/workflows/release.yml
New file
@@ -0,0 +1,57 @@
name: Release
'on':
  workflow_run:
    workflows:
      - Tests
      - Web-Performance
    branches:
      - master
    types:
      - completed
jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Check for Go files
        id: check_go
        uses: andstor/file-existence-action@v2
        with:
          files: "**/*.go"
      - name: Fetch all tags
        if: steps.check_go.outputs.files_exists == 'true'
        run: git fetch --force --tags
      - name: Set up Go
        if: steps.check_go.outputs.files_exists == 'true'
        uses: actions/setup-go@v5
        with:
          go-version: 'stable'
      - name: Install GoReleaser
        if: steps.check_go.outputs.files_exists == 'true'
        uses: goreleaser/goreleaser-action@v5
        with:
          install-only: true
      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
      - name: Create Github release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          if [[ "${{ steps.check_go.outputs.files_exists }}" == "true" ]]; then
            npx -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/git semantic-release
          else
            npx semantic-release
          fi
.github/workflows/tests.yml
New file
@@ -0,0 +1,274 @@
name: Tests
'on':
  push:
    branches:
      - master
  pull_request:
jobs:
  editorconfig:
    name: Editorconfig
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Install editorconfig-checker
        run: |
          gh release download --pattern "*linux-amd64.tar.gz" --dir /tmp
          tar --extract --gzip --strip-components 1 --file /tmp/ec-linux-amd64.tar.gz --directory /tmp
          chmod +x /tmp/ec-linux-amd64
          mv /tmp/ec-linux-amd64 /usr/local/bin/ec
        env:
          GH_REPO: editorconfig-checker/editorconfig-checker
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Run editorconfig-checker
        run: |
          ec
  dockerfile:
    name: Dockerfile
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Check for Dockerfile files
        id: check_dockerfile
        uses: andstor/file-existence-action@v2
        with:
          files: "**/Dockerfile*"
      - name: Install hadolint
        if: steps.check_dockerfile.outputs.files_exists == 'true'
        run: |
          gh release download --pattern "*Linux-x86_64" --dir /tmp
          chmod +x /tmp/hadolint-Linux-x86_64
          mv /tmp/hadolint-Linux-x86_64 /usr/local/bin/hadolint
        env:
          GH_REPO: hadolint/hadolint
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Run hadolint
        if: steps.check_dockerfile.outputs.files_exists == 'true'
        run: |
          find . -name "Dockerfile*" -not -name "Dockerfile.j2" -not -path "*/ansible_collections/*" -print0 | xargs -0 -I{} hadolint "{}"
  shell:
    name: Shell
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Check for Shell files
        id: check_shell
        uses: andstor/file-existence-action@v2
        with:
          files: "**/*.sh"
      - name: Install shellcheck
        if: steps.check_shell.outputs.files_exists == 'true'
        run: |
          gh release download --pattern "*linux.x86_64.tar.xz" --dir /tmp
          tar --extract --xz --strip-components 1 --file /tmp/shellcheck-*.linux.x86_64.tar.xz --directory /tmp
          chmod +x /tmp/shellcheck
          mv /tmp/shellcheck /usr/local/bin/shellcheck
        env:
          GH_REPO: koalaman/shellcheck
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Run shellcheck
        if: steps.check_shell.outputs.files_exists == 'true'
        run: |
          find . -name "*.sh" -not -path "*/ansible_collections/*" -print0 | xargs -0 -I{} shellcheck --external-sources "{}"
  yaml:
    name: YAML
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Check for YAML files
        id: check_yaml
        uses: andstor/file-existence-action@v2
        with:
          files: "**/*.yml"
      - name: Install yamllint
        if: steps.check_yaml.outputs.files_exists == 'true'
        run: |
          pip3 install --disable-pip-version-check yamllint
      - name: Run yamllint
        if: steps.check_yaml.outputs.files_exists == 'true'
        run: |
          yamllint --strict .
  python:
    name: Python
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Check for Python files
        id: check_python
        uses: andstor/file-existence-action@v2
        with:
          files: "**/*.py"
      - name: Install flake8
        if: steps.check_python.outputs.files_exists == 'true'
        run: |
          pip3 install --disable-pip-version-check flake8
      - name: Run flake8
        if: steps.check_python.outputs.files_exists == 'true'
        run: |
          flake8 --show-source .
      - name: Install isort
        if: steps.check_python.outputs.files_exists == 'true'
        run: |
          pip3 install --disable-pip-version-check isort[colors]
      - name: Run isort
        if: steps.check_python.outputs.files_exists == 'true'
        run: |
          isort . --check-only --diff --color
      - name: Check for Tox file
        id: check_tox
        uses: andstor/file-existence-action@v2
        with:
          files: "tox.ini"
      - name: Install tox
        if: steps.check_tox.outputs.files_exists == 'true'
        run: |
          pip3 install --disable-pip-version-check tox
      - name: Install test dependencies
        if: steps.check_tox.outputs.files_exists == 'true'
        run: |
          make dev-requirements
      - name: Run tox
        if: steps.check_tox.outputs.files_exists == 'true'
        run: |
          tox
  ansible:
    name: Ansible
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Check for Ansible files
        id: check_ansible
        uses: andstor/file-existence-action@v2
        with:
          files: "tasks, meta"
      - name: Set up Python 3.x
        if: steps.check_ansible.outputs.files_exists == 'true'
        uses: actions/setup-python@v5
        with:
          python-version: '3.x'
      - name: Install ansible
        if: steps.check_ansible.outputs.files_exists == 'true'
        run: |
          pip3 install --disable-pip-version-check ansible
      - name: Install ansible-lint
        if: steps.check_ansible.outputs.files_exists == 'true'
        run: |
          pip3 install --disable-pip-version-check ansible-lint
      - name: Run ansible-lint
        if: steps.check_ansible.outputs.files_exists == 'true'
        run: |
          ansible-lint --force-color .
      - name: Check for Molecule files
        id: check_molecule
        uses: andstor/file-existence-action@v2
        with:
          files: "molecule"
      - name: Install molecule
        if: steps.check_molecule.outputs.files_exists == 'true'
        run: |
          pip3 install --disable-pip-version-check molecule molecule-plugins[docker] pytest-testinfra
      - name: Run molecule
        if: steps.check_molecule.outputs.files_exists == 'true'
        run: |
          molecule test --all
  docker-compose:
    name: Docker-Compose
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Check for Docker-Compose test file
        id: check_docker_compose_test
        uses: andstor/file-existence-action@v2
        with:
          files: "docker-compose.test.yml"
      - name: Run docker-compose test
        if: steps.check_docker_compose_test.outputs.files_exists == 'true'
        run: |
          docker compose --file docker-compose.test.yml build
  go:
    name: Go
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
      - name: Check for Go files
        id: check_go
        uses: andstor/file-existence-action@v2
        with:
          files: "**/*.go"
      - name: Set up Go
        if: steps.check_go.outputs.files_exists == 'true'
        uses: actions/setup-go@v5
        with:
          go-version: 'stable'
      - name: Run go vet
        if: steps.check_go.outputs.files_exists == 'true'
        run: |
          go vet ./...
      - name: Run go test
        if: steps.check_go.outputs.files_exists == 'true'
        run: |
          go test -v -cover ./...
      - name: Install staticcheck
        if: steps.check_go.outputs.files_exists == 'true'
        run: |
          gh release download --pattern "*linux_amd64.tar.gz" --dir /tmp
          tar --extract --gzip --strip-components 1 --file /tmp/staticcheck_linux_amd64.tar.gz --directory /tmp
          chmod +x /tmp/staticcheck
          mv /tmp/staticcheck /usr/local/bin/staticcheck
        env:
          GH_REPO: dominikh/go-tools
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Run staticcheck
        if: steps.check_go.outputs.files_exists == 'true'
        run: |
          staticcheck
.gitignore
@@ -1,3 +1,5 @@
.DS_Store
Thumbs.db
public/
sitespeed-result/
.hugo_build.lock
.yamllint
New file
@@ -0,0 +1,9 @@
extends: default
rules:
  comments:
    min-spaces-from-content: 1
  comments-indentation: false
  document-start:
    present: false
  line-length: false
lighthouserc.json
File was deleted
tests/exampleSiteWithImage/budget.json
New file
@@ -0,0 +1,18 @@
{
    "budget": {
        "requests": {
            "total": 9
        },
        "transferSize": {
            "total": 321024
        },
        "thirdParty": {
            "requests": 4
        },
        "score": {
            "bestpractice": 93,
            "privacy": 72,
            "performance": 86
        }
    }
}
tests/exampleSiteWithImage/config.toml
copy from exampleSite/config.toml copy to tests/exampleSiteWithImage/config.toml
File was copied from exampleSite/config.toml
@@ -13,7 +13,7 @@
googleAnalytics = ""
# Copyright
copyright = "©2021 Your Name"
copyright = "©2024 Your Name"
[params]
tests/exampleSiteWithImage/content/_index.md
tests/exampleSiteWithImage/content/ipsum-in.md
tests/exampleSiteWithImage/content/luctus-urna.md
tests/exampleSiteWithImage/content/purus-sem.md
tests/exampleSiteWithImage/docker-compose.yml
New file
@@ -0,0 +1,20 @@
services:
  hugo:
    image: hugomods/hugo:latest
    volumes:
      - type: bind
        source: ../../../
        target: /src
    command: ["hugo", "server", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithImage", "--themesDir=/src"]
    ports:
      - "1313:1313"
  sitespeed:
    image: sitespeedio/sitespeed.io:latest
    volumes:
      - type: bind
        source: .
        target: /sitespeed.io
    depends_on:
      - hugo
    command: ["http://hugo:1313/index.html", "--budget.configPath=budget.json"]
tests/exampleSiteWithImage/static/css/style.css
tests/exampleSiteWithImage/static/favicon.ico
Binary files differ
tests/exampleSiteWithImage/static/images/background.jpg

tests/exampleSiteWithImage/static/images/social.jpg

tests/exampleSiteWithImage/static/videos/background.mp4
Binary files differ
tests/exampleSiteWithVideo/budget.json
New file
@@ -0,0 +1,18 @@
{
    "budget": {
        "requests": {
            "total": 9
        },
        "transferSize": {
            "total": 2048000
        },
        "thirdParty": {
            "requests": 4
        },
        "score": {
            "bestpractice": 93,
            "privacy": 72,
            "performance": 84
        }
    }
}
tests/exampleSiteWithVideo/config.toml
File was renamed from exampleSite/config.toml
@@ -13,7 +13,7 @@
googleAnalytics = ""
# Copyright
copyright = "©2021 Your Name"
copyright = "©2024 Your Name"
[params]
@@ -31,13 +31,13 @@
    # Image
    [params.visual.image]
      enable = true
      enable = false
      file = "images/background.jpg"
      position = "center center"
    # Video
    [params.visual.video]
      enable = false
      enable = true
      mute = true
      file = "videos/background.mp4"
      # youtubeId = "dk9uNWPP7EA"
tests/exampleSiteWithVideo/content/_index.md
copy from exampleSite/content/_index.md copy to tests/exampleSiteWithVideo/content/_index.md
tests/exampleSiteWithVideo/content/ipsum-in.md
copy from exampleSite/content/ipsum-in.md copy to tests/exampleSiteWithVideo/content/ipsum-in.md
tests/exampleSiteWithVideo/content/luctus-urna.md
copy from exampleSite/content/luctus-urna.md copy to tests/exampleSiteWithVideo/content/luctus-urna.md
tests/exampleSiteWithVideo/content/purus-sem.md
copy from exampleSite/content/purus-sem.md copy to tests/exampleSiteWithVideo/content/purus-sem.md
tests/exampleSiteWithVideo/docker-compose.yml
New file
@@ -0,0 +1,20 @@
services:
  hugo:
    image: hugomods/hugo:latest
    volumes:
      - type: bind
        source: ../../../
        target: /src
    command: ["hugo", "server", "--logLevel=info", "--bind=0.0.0.0", "--baseURL=http://hugo", "--disableLiveReload", "--source=/src/hugo-split-theme/tests/exampleSiteWithVideo", "--themesDir=/src"]
    ports:
      - "1313:1313"
  sitespeed:
    image: sitespeedio/sitespeed.io:latest
    volumes:
      - type: bind
        source: .
        target: /sitespeed.io
    depends_on:
      - hugo
    command: ["http://hugo:1313/index.html", "--budget.configPath=budget.json"]
tests/exampleSiteWithVideo/static/css/style.css
copy from exampleSite/static/css/style.css copy to tests/exampleSiteWithVideo/static/css/style.css
tests/exampleSiteWithVideo/static/favicon.ico
copy from exampleSite/static/favicon.ico copy to tests/exampleSiteWithVideo/static/favicon.ico Binary files differ
tests/exampleSiteWithVideo/static/images/background.jpg

tests/exampleSiteWithVideo/static/images/social.jpg

tests/exampleSiteWithVideo/static/videos/background.mp4
copy from exampleSite/static/videos/background.mp4 copy to tests/exampleSiteWithVideo/static/videos/background.mp4 Binary files differ