diff --git a/.github/workflows/test-sysmlv2-python-client.yml b/.github/workflows/test-sysmlv2-python-client.yml new file mode 100644 index 0000000..67b79aa --- /dev/null +++ b/.github/workflows/test-sysmlv2-python-client.yml @@ -0,0 +1,51 @@ +name: Test sysmlv2-python-client + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main, develop ] + +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('pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install pytest pytest-cov requests-mock + + - name: Run tests with coverage + run: | + mkdir -p test-results + pytest -v --tb=short \ + --junitxml=test-results/results.xml \ + --cov=src/sysmlv2_client \ + --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-sysmlv2-python-client + path: test-results/