-
Notifications
You must be signed in to change notification settings - Fork 7
Version and test flow #35
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: PredAI Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main, master, develop ] | ||
| push: | ||
| branches: [ main, master, develop ] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Cache pip packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('predai/requirements.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r predai/requirements.txt | ||
| - name: Run unit tests | ||
| run: | | ||
| python -m unittest test_predai.py -v | ||
| - name: Test summary | ||
| if: always() | ||
| run: | | ||
| if [ $? -eq 0 ]; then | ||
| echo "✅ All tests passed successfully!" | ||
| else | ||
| echo "❌ Some tests failed" | ||
| exit 1 | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| neuralprophet==0.9.0 | ||
| neuralprophet | ||
|
||
| requests | ||
| aiohttp | ||
| pyyaml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #!/bin/bash | ||
| # Run all PredAI unit tests | ||
|
|
||
| set -e | ||
|
|
||
| # Check if virtual environment exists | ||
| if [ ! -d "venv" ]; then | ||
| echo "Error: Virtual environment not found!" | ||
| echo "Please run ./setup.csh first to create the environment" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Activate virtual environment | ||
| echo "Activating virtual environment..." | ||
| source venv/bin/activate | ||
|
|
||
| # Run the tests | ||
| echo "" | ||
| echo "Running PredAI unit tests..." | ||
| echo "================================" | ||
| python -m unittest test_predai.py -v | ||
|
|
||
| # Check test result | ||
| if [ $? -eq 0 ]; then | ||
| echo "" | ||
| echo "================================" | ||
| echo "✅ All tests passed successfully!" | ||
| else | ||
| echo "" | ||
| echo "================================" | ||
| echo "❌ Some tests failed" | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+21
to
+33
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||
| # Setup script for PredAI test environment | ||||||
| # Creates a virtual environment and installs dependencies | ||||||
|
|
||||||
| echo "Creating Python virtual environment..." | ||||||
| python3 -m venv venv | ||||||
|
|
||||||
| echo "Activating virtual environment..." | ||||||
| source venv/bin/activate | ||||||
|
||||||
| source venv/bin/activate | |
| source venv/bin/activate.csh |
Copilot
AI
Dec 30, 2025
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 file uses 'echo' commands which are bash/sh syntax, but the file has a .csh extension indicating it should be a C shell script. C shell uses different syntax for commands and doesn't support echo in the same way. Either rename this file to setup.sh and add a proper shebang (#!/bin/bash), or rewrite it using proper csh syntax.
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.
Similar to the issue in run_all script, this conditional references$? after other commands have executed (the echo statements on lines 43-45). The $ ? will reflect the exit status of the echo command, not the unittest command on line 37. The exit status should be captured immediately after the test command completes.