Skip to content

Commit

Permalink
CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhavdeep13 committed Feb 7, 2025
1 parent 526a0e4 commit 819d37c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 69 deletions.
14 changes: 0 additions & 14 deletions .env

This file was deleted.

69 changes: 14 additions & 55 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ on:
jobs:
setup:
runs-on: ubuntu-latest
outputs:
cache-hit: ${{ steps.cache-deps.outputs.cache-hit }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
Expand All @@ -37,23 +35,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# Step 4: Cache dependencies
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}

# Step 5: Install dependencies if not cached
- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install .
pip install pytest
# Step 6: Create .env file
- name: Create .env file
run: |
Expand All @@ -76,42 +57,6 @@ jobs:
- name: Verify .env file
run: cat .env

test:
needs: setup # Ensure setup is completed before running tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false # Ensures all test jobs run even if one fails

steps:
# Step 1: Checkout correct branch
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: 315-Unittest-via-Github-actions # Ensure correct branch

# Step 2: Restore Cached Dependencies
- name: Restore Cached Dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}

# Step 3: Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# Step 4: Install dependencies (if cache is empty)
- name: Install dependencies (if needed)
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install .
pip install pytest
# Step 8: Start FIWARE services
- name: Start FIWARE Services
run: |
Expand All @@ -127,9 +72,23 @@ jobs:
curl -s http://localhost:8668/version && break || sleep 5
done
# Step 4: Install dependencies (if cache is empty)
- name: Install dependencies (if needed)
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install .
pip install pytest
# Step 10: Debug - Show Running Docker Containers
- name: Debug - Show Running Docker Containers
run: docker ps -a

# Step 6: Navigate back to tests folder
- name: Navigate to Tests Folder
run: |
cd $GITHUB_WORKSPACE
ls -la
# Step 6: Run Tests
- name: Run tests with unittest and pytest
Expand Down

0 comments on commit 819d37c

Please sign in to comment.