Skip to content

Commit ea45b7d

Browse files
authored
Merge pull request #2 from Unity-Lab-AI/codex/update-github-workflow-for-pull-requests
Add GitHub workflow for PR and main branch automation
2 parents 7d356fb + c638975 commit ea45b7d

4 files changed

Lines changed: 146 additions & 2 deletions

File tree

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
pr-tests:
11+
if: github.event_name == 'pull_request'
12+
runs-on: ubuntu-latest
13+
name: Run Tests
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Ensure test scripts are executable
19+
run: |
20+
if compgen -G "test/*.sh" > /dev/null; then
21+
chmod +x test/*.sh
22+
fi
23+
24+
- name: Execute pull request tests
25+
run: |
26+
set -euo pipefail
27+
if compgen -G "test/*.sh" > /dev/null; then
28+
for test_script in test/*.sh; do
29+
echo "Running ${test_script}"
30+
bash "${test_script}"
31+
done
32+
else
33+
echo "No tests found in ./test"
34+
fi
35+
36+
pr-report:
37+
if: github.event_name == 'pull_request'
38+
runs-on: ubuntu-latest
39+
name: Report Tests Statuses
40+
needs:
41+
- pr-tests
42+
steps:
43+
- name: Summarize pull request test results
44+
run: echo "Pull request tests completed successfully."
45+
46+
main-build:
47+
if: github.event_name != 'pull_request'
48+
runs-on: ubuntu-latest
49+
name: Build and Upload Artifacts
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- name: Build static site
55+
run: |
56+
set -euo pipefail
57+
mkdir -p build
58+
cp index.html build/
59+
cp style.css build/
60+
cp landing.js build/
61+
62+
- name: Upload static site artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: static-site
66+
path: build
67+
68+
main-report-build:
69+
if: github.event_name != 'pull_request'
70+
runs-on: ubuntu-latest
71+
name: Report Build Status
72+
needs:
73+
- main-build
74+
steps:
75+
- name: Report build outcome
76+
run: echo "Static site build completed successfully."
77+
78+
main-tests:
79+
if: github.event_name != 'pull_request'
80+
runs-on: ubuntu-latest
81+
name: Run Tests
82+
needs:
83+
- main-build
84+
steps:
85+
- name: Checkout repository
86+
uses: actions/checkout@v4
87+
88+
- name: Ensure test scripts are executable
89+
run: |
90+
if compgen -G "tests/*.sh" > /dev/null; then
91+
chmod +x tests/*.sh
92+
fi
93+
94+
- name: Execute main branch tests
95+
run: |
96+
set -euo pipefail
97+
if compgen -G "tests/*.sh" > /dev/null; then
98+
for test_script in tests/*.sh; do
99+
echo "Running ${test_script}"
100+
bash "${test_script}"
101+
done
102+
else
103+
echo "No tests found in ./tests"
104+
fi
105+
106+
main-report-tests:
107+
if: github.event_name != 'pull_request'
108+
runs-on: ubuntu-latest
109+
name: Report Tests Statuses
110+
needs:
111+
- main-tests
112+
steps:
113+
- name: Summarize main branch test results
114+
run: echo "Main branch tests completed successfully."
115+
116+
deploy-pages:
117+
if: github.event_name != 'pull_request'
118+
runs-on: ubuntu-latest
119+
name: Deploy to Pages
120+
needs:
121+
- main-build
122+
steps:
123+
- name: Deploy placeholder
124+
run: echo "Deploying static site to GitHub Pages (placeholder)."

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Talk to Unity in Plain English
22

3-
![Main Branch Workflow Status](https://github.com/Unity-Lab-AI/Talk-to-Unity/actions/workflows/main.yml/badge.svg?branch=main)
4-
![Pull Request Workflow Status](https://github.com/Unity-Lab-AI/Talk-to-Unity/actions/workflows/pull-request.yml/badge.svg)
3+
[![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)
4+
[![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)
55

66
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.
77

test/site_structure_test.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
echo "Checking that index.html exists..."
5+
[ -f "index.html" ]
6+
echo "Checking that landing.js exists..."
7+
[ -f "landing.js" ]
8+
echo "Checking that style.css exists..."
9+
[ -f "style.css" ]
10+
11+
echo "All required site files are present."

tests/content_integrity_test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if ! grep -q "<title>" index.html; then
5+
echo "index.html is missing a <title> element"
6+
exit 1
7+
fi
8+
9+
echo "Verified that index.html contains a <title> element."

0 commit comments

Comments
 (0)