Merge pull request #69 from isaaclins/fix/reaper-api-body #95
This file contains hidden or 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
| name: build-test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # Ensure only one run per branch at a time | |
| concurrency: | |
| group: "build-test-${{ github.ref }}" | |
| cancel-in-progress: false | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Read Hugo version | |
| run: | | |
| HUGO_VERSION="$(tr -d '[:space:]' < .hugo-version)" | |
| if [[ ! "$HUGO_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "::error::Invalid Hugo version in .hugo-version: $HUGO_VERSION" | |
| exit 1 | |
| fi | |
| echo "HUGO_VERSION=$HUGO_VERSION" >> "$GITHUB_ENV" | |
| - 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: Verify Hugo Version | |
| run: hugo version | |
| - name: Enforce Hugo minimum version | |
| run: python3 scripts/check-hugo-version.py | |
| - name: Install Dart Sass | |
| run: sudo snap install dart-sass | |
| - name: Check Dart Sass Version | |
| run: dart-sass --version | |
| - name: Build site (production settings) | |
| env: | |
| HUGO_ENVIRONMENT: production | |
| HUGO_ENV: production | |
| run: | | |
| hugo \ | |
| --gc \ | |
| --minify | |
| # ------------------------ | |
| # BEGIN PAGE VALIDATION | |
| # ------------------------ | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.x" | |
| - name: Install html5validator | |
| run: pip install --no-cache-dir html5validator | |
| - name: Validate generated HTML with html5validator | |
| run: html5validator --root public --also-check-css --also-check-svg --log-level ERROR | |
| # ------------------------ | |
| # SPELL CHECK | |
| # ------------------------ | |
| - name: Setup Node.js for cspell | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: "24" | |
| - name: Install cspell | |
| run: npm install -g cspell@latest | |
| - name: Run spell check on content (skip drafts) | |
| run: | | |
| # Find all markdown files that are NOT drafts | |
| FILES_TO_CHECK=$(find content -name "*.md" -exec grep -L "^draft = true" {} \; | grep -v "_TEMPLATE.md" || true) | |
| if [ -z "$FILES_TO_CHECK" ]; then | |
| echo "No non-draft files to check" | |
| exit 0 | |
| fi | |
| echo "Checking files:" | |
| echo "$FILES_TO_CHECK" | |
| # Run cspell and capture output (don't fail on errors) | |
| CSPELL_OUTPUT=$(echo "$FILES_TO_CHECK" | xargs cspell --config .cspell.json 2>&1) || true | |
| # Check if there are any spelling issues | |
| if echo "$CSPELL_OUTPUT" | grep -q "Unknown word"; then | |
| echo "## 📝 Spelling Issues Found" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "The following words were not recognized. Add them to \`.cspell.json\` if they're valid." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| File | Location | Word |" >> $GITHUB_STEP_SUMMARY | |
| echo "|------|----------|------|" >> $GITHUB_STEP_SUMMARY | |
| # Parse cspell output: "file:line:col - Unknown word (word)" | |
| echo "$CSPELL_OUTPUT" | grep "Unknown word" | while read -r line; do | |
| # Extract file path, location, and word | |
| FILE=$(echo "$line" | cut -d':' -f1) | |
| LINE_NUM=$(echo "$line" | cut -d':' -f2) | |
| COL=$(echo "$line" | cut -d':' -f3 | cut -d' ' -f1) | |
| WORD=$(echo "$line" | grep -oP '\(.*?\)' | tr -d '()') | |
| echo "| \`$FILE\` | $LINE_NUM:$COL | \`$WORD\` |" >> $GITHUB_STEP_SUMMARY | |
| done | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| ISSUE_COUNT=$(echo "$CSPELL_OUTPUT" | grep -c "Unknown word" || echo "0") | |
| echo "**Total: $ISSUE_COUNT issue(s)**" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "✅ No spelling issues found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| # Always exit successfully - spelling issues are informational only | |
| exit 0 | |
| # Optionally upload the generated site as an artifact for debugging | |
| - name: Upload built site artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: built-site | |
| path: public | |
| if-no-files-found: ignore |