Skip to content

Commit

Permalink
updated workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhavdeep13 committed Jan 17, 2025
1 parent cea8b23 commit bee2fb3
Showing 1 changed file with 78 additions and 15 deletions.
93 changes: 78 additions & 15 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,112 @@ on:
jobs:
setup:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install dependencies
# Step 3: Install build tools
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
# Step 4: Install dependencies
- name: Install dependencies
run: |
pip install .[development]
# Step 5: Create .env file
- name: Create .env file
run: |
echo "CB_URL=http://localhost:1026" > .env
echo "IOTA_URL=http://localhost:4041" >> .env
echo "QL_URL=http://localhost:8668" >> .env
echo "MQTT_BROKER_URL=mqtt://localhost:1883" >> .env
# Step 6: Verify .env file
- name: Verify environment setup
run: |
echo "Verifying .env file:"
cat .env
fiware_setup:
runs-on: ubuntu-latest
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

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

# Step 2: Clone the FIWARE platform repository
- name: Clone FIWARE repository
run: |
git clone https://github.com/N5GEH/n5geh.platform.git
# Step 3: Start FIWARE services
- name: Start FIWARE services
run: |
cd n5geh.platform/v2
docker compose up -d
working-directory: n5geh.platform/v2
run: docker compose up -d

- name: Wait for FIWARE services to stabilize
run: sleep 30

- name: Verify FIWARE services
run: curl -X GET "http://localhost:1026/version"
# Step 4: Wait for FIWARE services
- name: Wait for FIWARE services to start
run: |
for i in {1..30}; do
curl -s http://localhost:1026/version && break || sleep 2
done
test:
runs-on: ubuntu-latest
needs: fiware_setup
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]

steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v3

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

# Step 3: Install build tools
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
# Step 4: Install test dependencies
- name: Install test dependencies
run: |
pip install .[test]
pip install pytest
# Step 5: Run tests
- name: Run tests with both unittest and pytest
run: |
docker compose run --rm orion bash -c "pytest tests || true"
TEST_PATH="tests"
echo "Running tests with unittest:"
python -m unittest discover -s $TEST_PATH -p "test_*.py" || true
echo "Running tests with pytest:"
python -m pytest $TEST_PATH || true

0 comments on commit bee2fb3

Please sign in to comment.