Develop #51
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: Test flexo_syside | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths-ignore: | |
| - '.github/**' | |
| pull_request: | |
| branches: [ main, develop ] | |
| paths-ignore: | |
| - '.github/**' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| id: setup-python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| # Install dependencies that are available in CI | |
| pip install requests | |
| pip install git+https://github.com/Open-MBEE/sysmlv2-python-client.git@main | |
| pip install -e . | |
| pip install pytest pytest-cov | |
| # Note: syside will be mocked by conftest.py in CI environment | |
| - name: Set up SysIDE license (if available) | |
| run: | | |
| if [ -n "$SYSIDE_LICENSE_KEY" ]; then | |
| echo "SysIDE license key found, attempting to set up license..." | |
| python -c " | |
| try: | |
| import syside_license | |
| syside_license.check('$SYSIDE_LICENSE_KEY') | |
| print('SysIDE license activated successfully') | |
| except ImportError: | |
| print('syside_license not available, tests will use mocks') | |
| except Exception as e: | |
| print(f'Failed to activate SysIDE license: {e}, tests will use mocks') | |
| " || echo "License setup failed, tests will use mocks" | |
| else | |
| echo "No SysIDE license key found, tests will use mocks" | |
| fi | |
| env: | |
| SYSIDE_LICENSE_KEY: ${{ secrets.SYSIDE_LICENSE_KEY }} | |
| - name: Run tests with coverage | |
| run: | | |
| mkdir -p test-results | |
| pytest -v --tb=short \ | |
| --junitxml=test-results/results.xml \ | |
| --cov=src/flexo_syside_lib \ | |
| --cov-report=xml:test-results/coverage.xml \ | |
| --cov-report=html:test-results/htmlcov | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-flexo-syside | |
| path: test-results/ |