[199][Feedback wanted] Documentation on how to customize content #268
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow to verify that the exampleSite runs ok | |
name: Test example site | |
on: | |
# Runs on pull requests targeting the default branch | |
pull_request: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
CI: true | |
jobs: | |
# Build job | |
build-and-test: | |
runs-on: ubuntu-latest | |
env: | |
HUGO_VERSION: 0.136.2 | |
steps: | |
- name: Install Hugo CLI | |
run: | | |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
key: modules-${{ hashFiles('package-lock.json') }} | |
- name: Cache Playwright Browsers | |
id: cache-playwright | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: playwright-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright browsers | |
if: steps.cache-playwright.outputs.cache-hit != 'true' | |
run: npx playwright install --with-deps | |
- name: Build site (no menus) | |
run: | | |
cd exampleSite | |
hugo server --themesDir ../.. --buildDrafts --buildFuture --bind 0.0.0.0 --config hugo.toml,hugo.disablemenu.toml & | |
sleep 10 | |
- name: Run Playwright tests (no menus) | |
run: npm run test:e2e:no-menus | |
- name: Stop hugo server | |
run: | | |
killall hugo | |
- name: Build and serve demo site (default; with menus) | |
run: | | |
cd exampleSite | |
hugo server --themesDir ../.. --buildDrafts --buildFuture --bind 0.0.0.0 & | |
sleep 10 | |
- name: Run Playwright tests (default; with menus) | |
run: npm run test:e2e | |
- name: Get the failure count | |
id: tests | |
run: | | |
export count=$(cat ./playwright-report/result.txt | grep Failed | cut -d ':' -f 2 | tr -d ' ') | |
echo "fail_count=$count" >> "$GITHUB_OUTPUT" | |
echo $count | |
# - uses: mshick/add-pr-comment@v2 | |
# if: always() | |
# with: | |
# message-path: | | |
# ./playwright-report/result.txt | |
# message-failure: | | |
# Workflow failed | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload Artifact for pages | |
if: always() | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./playwright-report" | |
# - name: Fail the job if there any failed case | |
# if: steps.tests.outputs.fail_count != '0' | |
# run : | | |
# exit 1 | |
outputs: | |
fail_count: ${{ steps.tests.outputs.fail_count }} | |
publish-reports: | |
# if: ${{ contains(github.ref,'main') && (contains(fromJSON('[ "push"]'), github.event_name))}} | |
continue-on-error: true | |
needs: [ build-and-test ] | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |