diff options
author | Jordan Cook <jordan.cook@pioneer.com> | 2021-03-31 13:09:27 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook@pioneer.com> | 2021-03-31 21:30:35 -0500 |
commit | 2a9fa345273acd3bd9077b71130b7a2b59adbe7e (patch) | |
tree | 9db373e569a3f7382f2a2b7e8c0a670a90a982a6 /.github | |
parent | 024070cbd6e4ee904e1f23f914a5c1a49d229669 (diff) | |
download | requests-cache-2a9fa345273acd3bd9077b71130b7a2b59adbe7e.tar.gz |
Combine coverage report with py3.9 unit tests to reduce total container startup time
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build.yml | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14fb221..81a4427 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,8 @@ on: pull_request: branches: [master, dev] workflow_dispatch: +env: + LATEST_PY_VERSION: '3.9' jobs: # Run unit tests for each supported python version @@ -27,7 +29,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - # Start integration test databases (for per-python version tests) + # Start integration test databases - uses: supercharge/mongodb-github-action@1.3.0 with: mongodb-version: 4.4 @@ -43,48 +45,47 @@ jobs: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }} restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: Install dependencies run: pip install ".[dev]" + + # Latest python version: Run unit tests with coverage and send to coveralls + - name: Run unit tests with code coverage report + if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} + run: pytest tests --cov=requests_cache --cov-report=term --cov-report=html + - name: Send code coverage report to Coveralls + if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: coveralls --service=github + + # All other python versions: just run unit tests - name: Run unit tests + if: ${{ matrix.python-version != env.LATEST_PY_VERSION }} run: pytest - # Run code analysis checks, reports, etc. + # Run code analysis checks analyze: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: ${{ env.LATEST_PY_VERSION }} + + # Cache packages for latest python version, and reuse until setup.py changes - name: Cache pip packages uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-3.8-${{ hashFiles('setup.py') }} - restore-keys: ${{ runner.os }}-pip-3.8 - - # Start integration test databases (for generating code coverage report) - - uses: supercharge/mongodb-github-action@1.3.0 - with: - mongodb-version: 4.4 - - uses: supercharge/redis-github-action@1.2.0 - with: - redis-version: '6' - - uses: rrainn/dynamodb-action@v2.0.0 - + key: ${{ runner.os }}-pip-${{ env.LATEST_PY_VERSION }}-${{ hashFiles('setup.py') }} + restore-keys: ${{ runner.os }}-pip-${{ env.LATEST_PY_VERSION }} - name: Install dependencies run: pip install ".[dev]" - - name: Run style checks - run: | - black --check --diff . - isort --check --diff . - - name: Generate code coverage report - run: pytest tests --cov=requests_cache --cov-report=term --cov-report=html - - name: Send code coverage report to Coveralls - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: coveralls --service=github + + - name: Run black check + run: black --check --diff . + - name: Run isort check + run: isort --check --diff . # Deploy stable builds on tags only release: |