-
Notifications
You must be signed in to change notification settings - Fork 2
GH action to spin up test app #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
767169f
GH action to spin up test app
ismasan 9b87246
Test pulling D* repo via gaspachoking/datastar branch with fixes
ismasan 7f2a969
Guard against missing events in test app
ismasan bab598d
Run Go tests in ismasan/datastar@go_sdk_tests
ismasan 8484637
Point Go tests to main d* repo, develop branch
ismasan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| name: Test Ruby Gem with Rack App | ||
|
|
||
| on: | ||
| push: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: 3.3.5 | ||
| bundler-cache: true | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| bundle install | ||
| gem install bundler | ||
|
|
||
| - name: Run unit tests | ||
| run: bundle exec rspec | ||
|
|
||
| - name: Start Rack test app | ||
| run: | | ||
| # Start the test app in background on port 8000 | ||
| bundle exec puma -p 8000 examples/test.ru & | ||
|
|
||
| # Store the PID for cleanup | ||
| echo $! > rack_app.pid | ||
|
|
||
| # Wait for the app to start | ||
| sleep 3 | ||
|
|
||
| # Verify the app is running | ||
| curl -f http://localhost:8000/ || (echo "App failed to start" && exit 1) | ||
|
|
||
| - name: Checkout datastar repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: starfederation/datastar | ||
| ref: develop | ||
| path: datastar | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
| cache-dependency-path: datastar/sdk/tests | ||
|
|
||
| - name: Run SDK tests against test server | ||
| working-directory: datastar/sdk/tests | ||
| run: go run ./cmd/datastar-sdk-tests -server http://localhost:8000 | ||
|
|
||
| - name: Cleanup | ||
| if: always() | ||
| run: | | ||
| # Kill the Rack app if it's still running | ||
| if [ -f rack_app.pid ]; then | ||
| kill $(cat rack_app.pid) 2>/dev/null || true | ||
| rm rack_app.pid | ||
| fi | ||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already done by
ruby/setup-ruby.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True! Thanks @benpickles #4