Skip to content

Reduce external integration points #141

Reduce external integration points

Reduce external integration points #141

Workflow file for this run

name: PR Validation
on: pull_request
env:
THEME_NAME: hugo-creator
LATEST_HUGO_VERSION: 0.102.3
SITE_FOLDER_PATH: exampleSite
jobs:
dependency-review:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
imagecompressor:
# Only run on Pull Requests within the same repository, and not from forks.
if: github.event.pull_request.head.repo.full_name == github.repository
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Compress Images
uses: calibreapp/image-actions@main
with:
# The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories.
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
githubToken: ${{ secrets.GITHUB_TOKEN }}
matrixBuild:
needs: [dependency-review, imagecompressor]
name: "Build (Node, Hugo) - "
runs-on: ubuntu-latest
strategy:
matrix:
node: [16]
hugo: [0.76.5, 0.95.0, 0.96.0, 0.97.3]
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Setup Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Setup Hugo ${{ matrix.hugo }}
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ matrix.hugo }}
extended: true
- name: Build
run: |
pushd $SITE_FOLDER_PATH
npm ci
hugo --minify --theme "$THEME_NAME" --themesDir "../../" --baseURL "/"
popd
contentLinter:
runs-on: ubuntu-latest
needs: matrixBuild
name: "Run linting"
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
################################
# Run Linter against code base #
################################
- name: Lint ${{env.SITE_FOLDER_PATH}} Content
uses: github/super-linter@v5
env:
FILTER_REGEX_INCLUDE: ${{env.SITE_FOLDER_PATH}}/content/**
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
################################
# Run Linter against code base #
################################
- name: Lint ${{env.THEME_NAME}} Theme Archetypes Folder
uses: github/super-linter@v5
env:
FILTER_REGEX_INCLUDE: archetypes/**
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
htmlproofer:
needs: matrixBuild
name: Verify exampleSite HTML Output
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ env.LATEST_HUGO_VERSION }}
extended: true
- name: Wait for the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1
id: netlify
with:
site_name: ${{ env.THEME_NAME }}
- name: "Build Hugo"
run: |
pushd $SITE_FOLDER_PATH
npm ci
hugo --minify --theme "$THEME_NAME" --themesDir "../../" --baseURL ${{ steps.netlify.outputs.url }}
popd
- name: "Check HTML Output"
run: |
pushd $SITE_FOLDER_PATH/public
sudo gem install html-proofer
htmlproofer -v
htmlproofer --allow-hash-href --disable-external true
lighthouse:
needs: matrixBuild
name: "Lighthouse Eval"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Wait for the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1
id: netlify
with:
site_name: ${{ env.THEME_NAME }}
- name: Use Node.js 10.x
uses: actions/setup-node@v3
with:
node-version: 10.x
- name: Lighthouse ${{ env.THEME_NAME }} (Preview)
run: |
npm install -g @lhci/[email protected]
lhci collect --urls ${{ steps.netlify.outputs.url }} --url ${{ steps.netlify.outputs.url }}/blog/ --url ${{ steps.netlify.outputs.url }}/talk/ --url ${{ steps.netlify.outputs.url }}/person/ --url ${{ steps.netlify.outputs.url }}/series/ --url ${{ steps.netlify.outputs.url }}/episode/
lhci upload --target "temporary-public-storage"
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}