From c6389750ec5d21a3115f705d733210b10c79985d Mon Sep 17 00:00:00 2001 From: G-Fourteen Date: Mon, 3 Nov 2025 01:19:32 -0700 Subject: [PATCH] Add combined workflow for PR and main checks --- .github/workflows/continuous-integration.yml | 124 +++++++++++++++++++ README.md | 4 +- test/site_structure_test.sh | 11 ++ tests/content_integrity_test.sh | 9 ++ 4 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/continuous-integration.yml create mode 100755 test/site_structure_test.sh create mode 100755 tests/content_integrity_test.sh diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..2d16575 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,124 @@ +name: Continuous Integration + +on: + pull_request: + push: + branches: + - main + +jobs: + pr-tests: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + name: Run Tests + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Ensure test scripts are executable + run: | + if compgen -G "test/*.sh" > /dev/null; then + chmod +x test/*.sh + fi + + - name: Execute pull request tests + run: | + set -euo pipefail + if compgen -G "test/*.sh" > /dev/null; then + for test_script in test/*.sh; do + echo "Running ${test_script}" + bash "${test_script}" + done + else + echo "No tests found in ./test" + fi + + pr-report: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + name: Report Tests Statuses + needs: + - pr-tests + steps: + - name: Summarize pull request test results + run: echo "Pull request tests completed successfully." + + main-build: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + name: Build and Upload Artifacts + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build static site + run: | + set -euo pipefail + mkdir -p build + cp index.html build/ + cp style.css build/ + cp landing.js build/ + + - name: Upload static site artifact + uses: actions/upload-artifact@v4 + with: + name: static-site + path: build + + main-report-build: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + name: Report Build Status + needs: + - main-build + steps: + - name: Report build outcome + run: echo "Static site build completed successfully." + + main-tests: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + name: Run Tests + needs: + - main-build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Ensure test scripts are executable + run: | + if compgen -G "tests/*.sh" > /dev/null; then + chmod +x tests/*.sh + fi + + - name: Execute main branch tests + run: | + set -euo pipefail + if compgen -G "tests/*.sh" > /dev/null; then + for test_script in tests/*.sh; do + echo "Running ${test_script}" + bash "${test_script}" + done + else + echo "No tests found in ./tests" + fi + + main-report-tests: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + name: Report Tests Statuses + needs: + - main-tests + steps: + - name: Summarize main branch test results + run: echo "Main branch tests completed successfully." + + deploy-pages: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + name: Deploy to Pages + needs: + - main-build + steps: + - name: Deploy placeholder + run: echo "Deploying static site to GitHub Pages (placeholder)." diff --git a/README.md b/README.md index 221e4f9..77dc585 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Talk to Unity in Plain English -![Main Branch Workflow Status](https://github.com/Unity-Lab-AI/Talk-to-Unity/actions/workflows/main.yml/badge.svg?branch=main) -![Pull Request Workflow Status](https://github.com/Unity-Lab-AI/Talk-to-Unity/actions/workflows/pull-request.yml/badge.svg) +[![Main Pipeline Status](https://github.com/Unity-Lab-AI/Talk/actions/workflows/continuous-integration.yml/badge.svg?branch=main)](https://github.com/Unity-Lab-AI/Talk/actions/workflows/continuous-integration.yml) +[![Pull Request Checks](https://github.com/Unity-Lab-AI/Talk/actions/workflows/continuous-integration.yml/badge.svg?event=pull_request)](https://github.com/Unity-Lab-AI/Talk/actions/workflows/continuous-integration.yml) Talk to Unity is a single web page that acts like a friendly concierge. The landing screen double-checks that your browser has everything it needs (secure connection, microphone, speech tools). Once every light turns green, a voice assistant named **Unity** wakes up so you can talk out loud and hear it answer back. diff --git a/test/site_structure_test.sh b/test/site_structure_test.sh new file mode 100755 index 0000000..e74d12e --- /dev/null +++ b/test/site_structure_test.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "Checking that index.html exists..." +[ -f "index.html" ] +echo "Checking that landing.js exists..." +[ -f "landing.js" ] +echo "Checking that style.css exists..." +[ -f "style.css" ] + +echo "All required site files are present." diff --git a/tests/content_integrity_test.sh b/tests/content_integrity_test.sh new file mode 100755 index 0000000..45c762a --- /dev/null +++ b/tests/content_integrity_test.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail + +if ! grep -q "" index.html; then + echo "index.html is missing a <title> element" + exit 1 +fi + +echo "Verified that index.html contains a <title> element."