Skip to content

CI: Test executable#3

Merged
stevepolitodesign merged 1 commit intomainfrom
sp-ci
Nov 25, 2025
Merged

CI: Test executable#3
stevepolitodesign merged 1 commit intomainfrom
sp-ci

Conversation

@stevepolitodesign
Copy link
Owner

Adds end-to-end coverage ensuring the executable successfully generates
a passing Rails build.

@stevepolitodesign stevepolitodesign force-pushed the sp-ci branch 3 times, most recently from 6b27634 to 0cfd527 Compare November 25, 2025 17:42
Adds end-to-end coverage ensuring the executable successfully generates
a passing Rails build.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds end-to-end testing for the Staples executable by creating a new CI job that generates a Rails application, runs its tests, and verifies it can start successfully.

Key changes:

  • Adds a new test-template job to the GitHub Actions workflow with PostgreSQL service
  • Implements complete lifecycle testing: app generation, database setup, test execution, and server startup verification

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

staples test_app
- name: Set up generated app
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DATABASE_URL is missing the database name. PostgreSQL connection URLs should include the database name: postgres://postgres:postgres@localhost:5432/test_app_development (or appropriate database name).

Copilot uses AI. Check for mistakes.
- name: Run tests in generated app
env:
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:5432
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DATABASE_URL is missing the database name. For the test environment, this should be postgres://postgres:postgres@localhost:5432/test_app_test (or appropriate test database name).

Copilot uses AI. Check for mistakes.
run: bin/rails test:all
- name: Verify app can start
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DATABASE_URL is missing the database name. PostgreSQL connection URLs should include the database name: postgres://postgres:postgres@localhost:5432/test_app_development (or appropriate database name).

Copilot uses AI. Check for mistakes.

steps:
- name: Checkout template
uses: actions/checkout@v4
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkout action is missing persist-credentials: false which is a security best practice used in the build job (line 23). This prevents the GITHUB_TOKEN from persisting in the git config, reducing the risk of credential exposure.

Suggested change
uses: actions/checkout@v4
uses: actions/checkout@v4
with:
persist-credentials: false

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +84
sleep 5
curl -f http://localhost:3000 || exit 1
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timeout command will terminate the server after 10 seconds, but the subsequent curl request happens after only 5 seconds. The timeout approach is fragile. Consider using a more robust verification that waits for the server to be ready, such as a retry loop with curl until the port responds or the server logs indicate readiness.

Suggested change
sleep 5
curl -f http://localhost:3000 || exit 1
for i in {1..30}; do
if curl -fs http://localhost:3000 > /dev/null; then
echo "Server is up!"
break
fi
sleep 1
done
# Final check, fail if not up
curl -f http://localhost:3000 || (echo "Server did not start in time" && exit 1)

Copilot uses AI. Check for mistakes.
@stevepolitodesign stevepolitodesign merged commit 37c49ad into main Nov 25, 2025
9 checks passed
@stevepolitodesign stevepolitodesign deleted the sp-ci branch November 25, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants