feat: UV venv support. #56
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: Run Tests (ut + ft) | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| push: | |
| branches: | |
| - main | |
| env: | |
| SOURCE_PATH: 'src' | |
| VIRTUALENV_PATH: 'virtualenv' | |
| PROJECT_NAME: 'mfd-code-quality' | |
| jobs: | |
| get_tests_to_run: | |
| runs-on: "ubuntu-latest" | |
| outputs: | |
| run_unit_tests: ${{ steps.tests_path_existence.outputs.run_unit_tests }} | |
| run_functional_tests: ${{ steps.tests_path_existence.outputs.run_functional_tests }} | |
| steps: | |
| - name: Checkout this repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: ${{ env.SOURCE_PATH }} | |
| - name: Determine if unit and functional tests should run | |
| id: tests_path_existence | |
| shell: bash | |
| run: | | |
| UNIT_TEST_DIR="${{ env.SOURCE_PATH }}/tests/unit/test_$(echo "${{ env.PROJECT_NAME }}" | tr '-' '_')" | |
| FUNC_TEST_DIR="${{ env.SOURCE_PATH }}/tests/system/test_$(echo "${{ env.PROJECT_NAME }}" | tr '-' '_')" | |
| if [ -d "$UNIT_TEST_DIR" ]; then | |
| echo "Unit tests directory exists: $UNIT_TEST_DIR" | |
| echo "run_unit_tests=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Unit tests directory does not exist: $UNIT_TEST_DIR" | |
| echo "run_unit_tests=false" >> $GITHUB_OUTPUT | |
| fi | |
| if [ -d "$FUNC_TEST_DIR" ]; then | |
| echo "Functional tests directory exists: $FUNC_TEST_DIR" | |
| echo "run_functional_tests=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "Functional tests directory does not exist: $FUNC_TEST_DIR" | |
| echo "run_functional_tests=false" >> $GITHUB_OUTPUT | |
| fi | |
| run_ft_tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python_version: ['3.10', '3.13'] | |
| name: run_ft_tests_${{ matrix.os }} | |
| needs: get_tests_to_run | |
| if: ${{ needs.get_tests_to_run.outputs.run_functional_tests == 'true' }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout this repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: current_repo | |
| - uses: ./current_repo/.github/prepare_test_env | |
| with: | |
| PYTHON_VERSION: ${{ matrix.python_version }} | |
| - name: Run Functional Tests | |
| shell: bash | |
| run: | | |
| source ${{ env.VIRTUALENV_PATH }}/*/activate | |
| pushd ${{ env.SOURCE_PATH }} | |
| mfd-system-tests --project-dir . | |
| run_ut_tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python_version: ['3.10', '3.13'] | |
| name: run_ut_tests_${{ matrix.os }} | |
| needs: get_tests_to_run | |
| if: ${{ needs.get_tests_to_run.outputs.run_unit_tests == 'true' }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout this repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: current_repo | |
| - uses: ./current_repo/.github/prepare_test_env | |
| with: | |
| PYTHON_VERSION: ${{ matrix.python_version }} | |
| - name: Run Unit Tests | |
| shell: bash | |
| run: | | |
| source ${{ env.VIRTUALENV_PATH }}/*/activate | |
| python --version | |
| pushd ${{ env.SOURCE_PATH }} | |
| mfd-unit-tests-with-coverage --project-dir . | |
| - name: Coveralls GitHub Action | |
| uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b #v2.3.6 |