From bfde6f5b4247e4300d012539f1ffdd0c4f5d6a7f Mon Sep 17 00:00:00 2001 From: Roberto Rossini <71787608+robomics@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:31:55 +0100 Subject: [PATCH] Simplify CI by adding the "minimal_install" param to the job matrix --- .github/workflows/ci.yml | 73 ++++++++++------------------------------ 1 file changed, 17 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca3fcd49..21047f82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,8 @@ jobs: var includes = [] for (const plat of platforms) { for (const ver of python_versions) { - includes.push({os: plat, python_version: ver}) + includes.push({os: plat, python_version: ver, minimal_install: true}) + includes.push({os: plat, python_version: ver, minimal_install: false}) } } @@ -88,39 +89,20 @@ jobs: cache: pip cache-dependency-path: pyproject.toml - - name: Install package (Unix) - if: runner.os != 'Windows' + - name: Install package run: | python -m venv venv - python -m venv venv-core - venv/bin/pip install '.[all,test]' - venv-core/bin/pip install '.' pytest pytest-cov - - echo "STRIPEPY_ROOT=venv/bin" >> "$GITHUB_ENV" - echo "STRIPEPY_CORE_ROOT=venv-core/bin" >> "$GITHUB_ENV" - - - name: Install package (Windows) - if: runner.os == 'Windows' - run: | - python -m venv venv - python -m venv venv-core - - venv/Scripts/pip install '.[all,test]' - venv-core/Scripts/pip install '.' pytest pytest-cov - - echo "STRIPEPY_ROOT=venv/Scripts" >> "$GITHUB_ENV" - echo "STRIPEPY_CORE_ROOT=venv-core/Scripts" >> "$GITHUB_ENV" + if [[ ${{ matrix.minimal_install }} == 'true' ]]; then + pip install '.' pytest pytest-cov + else + pip install '.[all,test]' + fi - name: Run simple CLI tests run: | - "$STRIPEPY_ROOT/stripepy" --help - "$STRIPEPY_ROOT/stripepy" --version - - - name: Run simple CLI tests (core) - run: | - "$STRIPEPY_CORE_ROOT/stripepy" --help - "$STRIPEPY_CORE_ROOT/stripepy" --version + stripepy --help + stripepy --version - name: Restore test dataset uses: actions/cache/restore@v4 @@ -132,7 +114,7 @@ jobs: - name: Run unit tests run: | - "$STRIPEPY_ROOT/python" -m pytest \ + python -m pytest \ --cov=stripepy \ --verbose \ --cov-report=xml \ @@ -141,6 +123,7 @@ jobs: -m unit - name: Upload unit test coverage report to Codecov + if: matrix.minimal_install == 'true' uses: codecov/codecov-action@v5 with: flags: "tests | unit | python-${{ matrix.python_version }}" @@ -150,19 +133,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} verbose: true - - name: Run unit tests (core) - run: | - rm -f coverage.xml - - "$STRIPEPY_CORE_ROOT/python" -m pytest \ - --cov=stripepy \ - --verbose \ - --cov-report=xml \ - --cov-report=term \ - test/ \ - -m unit - - - name: Upload unit test coverage report to Codecov (core) + - name: Upload unit test coverage report to Codecov + if: matrix.minimal_install != 'true' uses: codecov/codecov-action@v5 with: flags: "tests | unit | python-${{ matrix.python_version }} | core" @@ -171,12 +143,11 @@ jobs: fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} verbose: true - - name: Run integration tests run: | rm -f coverage.xml - "$STRIPEPY_ROOT/python" -m pytest \ + python -m pytest \ --cov=stripepy \ --verbose \ --cov-report=xml \ @@ -185,6 +156,7 @@ jobs: -m end2end - name: Upload end2end test coverage report to Codecov + if: matrix.minimal_install == 'true' uses: codecov/codecov-action@v5 with: flags: "tests | integration | python-${{ matrix.python_version }}" @@ -194,19 +166,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} verbose: true - - name: Run integration tests (core) - run: | - rm -f coverage.xml - - "$STRIPEPY_CORE_ROOT/python" -m pytest \ - --cov=stripepy \ - --verbose \ - --cov-report=xml \ - --cov-report=term \ - test/ \ - -m end2end - - name: Upload end2end test coverage report to Codecov (core) + if: matrix.minimal_install != 'true' uses: codecov/codecov-action@v5 with: flags: "tests | integration | python-${{ matrix.python_version }} | core"