Skip to content

Commit

Permalink
Simplify CI by adding the "minimal_install" param to the job matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Jan 13, 2025
1 parent 53c5e5c commit bfde6f5
Showing 1 changed file with 17 additions and 56 deletions.
73 changes: 17 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})
}
}
Expand Down Expand Up @@ -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
Expand All @@ -132,7 +114,7 @@ jobs:

- name: Run unit tests
run: |
"$STRIPEPY_ROOT/python" -m pytest \
python -m pytest \
--cov=stripepy \
--verbose \
--cov-report=xml \
Expand All @@ -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 }}"
Expand All @@ -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"
Expand All @@ -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 \
Expand All @@ -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 }}"
Expand All @@ -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"
Expand Down

0 comments on commit bfde6f5

Please sign in to comment.