updated workflow #37
This file contains 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 for FiLiP | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- main | |
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 | |
# 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 | |
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 | |
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] | |
pip install pytest | |
# Step 5: Run tests | |
- name: Run tests with both unittest and pytest | |
run: | | |
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 |