Skip to content

updated workflow

updated workflow #32

Workflow file for this run

name: CI for FiLiP
on:
push:
branches:
- "**"
pull_request:
branches:
- main
jobs:
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
# 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 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:
needs: setup
runs-on: ubuntu-latest
steps:
# Step 1: Clone the FIWARE platform repository
- name: Clone FIWARE repository
run: |
git clone https://github.com/N5GEH/n5geh.platform.git
# Step 2: Navigate to the correct directory
- name: Navigate to v2 directory
working-directory: n5geh.platform/v2
run: echo "In FIWARE v2 directory"
# Step 3: Start FIWARE services
- name: Start FIWARE services
working-directory: n5geh.platform/v2
run: docker compose up -d
# 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:
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
# 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]
# Step 5: Run unit tests
- name: Run unittests
run: |
python -m unittest discover -s tests -p "test_*.py"
# Step 6: Run pytest (optional, if you have pytest-based tests)
- name: Run pytest
run: |
python -m pytest tests || true