Github_actions_updated #2
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
| name: CI Tests | |
| # Trigger the workflow on pushes and pull requests to the main branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest # Use the latest Ubuntu runner | |
| steps: | |
| # Step 1: Checkout the repository code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Step 2: Set up Python environment | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' # Specify your Python version | |
| # Step 3: Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # Step 4: Run unit tests | |
| - name: Run tests | |
| run: | | |
| python -m unittest discover -s tests -p "test_*.py" | |
| # Optional: Cache dependencies to speed up future runs | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- |