-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to GitHub Actions/Workflows (#151)
- Updates to GH Actions and pre-commit hooks - Enable caching of pip reqs - Enable code coverage generation and reporting - Removed unused workflow files - Update README to add badges - Re-enable pip-compile hook; regenerate requirements.txt - Remove requirements_dev.txt; not used
- Loading branch information
1 parent
5793e0b
commit ab608b3
Showing
18 changed files
with
665 additions
and
228 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "release*" | ||
- "*-devel" | ||
- "*_devel" | ||
- "*-ci" | ||
- "*_ci" | ||
pull_request: # Run on all pull requests | ||
workflow_dispatch: # needed for "Run" button to show up in action | ||
env: | ||
FORCE_COLOR: "1" # Make tools pretty. | ||
PIP_DISABLE_PIP_VERSION_CHECK: "1" | ||
PIP_NO_PYTHON_VERSION_WARNING: "1" | ||
|
||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
# Ensure that if even if a build in the matrix fails, the others continue | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
# Enable caching of pip packages between workflow jobs. This can speed things up dramatically, _if_ | ||
# jobs are executed fairly close together in time | ||
# See: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages | ||
cache: 'pip' | ||
cache-dependency-path: 'requirements.txt' | ||
- name: Install dependencies | ||
run: | | ||
# Install requirements, as compiled by pip-compile | ||
pip install -r requirements.txt | ||
# Install dysh itself, in editable mode (which is required to avoid breaking the caching mechanism above) | ||
pip install -e . | ||
- name: Test with pytest | ||
run: | | ||
# Write coverage data files, namespaced using matrix info | ||
coverage run --data-file=".coverage.${{ matrix.os }}.${{ matrix.python-version }}" -m pytest | ||
- name: Upload coverage data | ||
# Upload only ubuntu results, since we are only running the coverage step on ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-data | ||
path: ".coverage.ubuntu-latest*" | ||
coverage: | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
cache: pip | ||
- run: pip install --upgrade coverage[toml] | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage-data | ||
- name: Combine coverage | ||
run: | | ||
coverage combine | ||
coverage html --skip-covered --skip-empty | ||
# Report and write to summary. | ||
coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY | ||
# Report again and fail if under 100%. | ||
# coverage report --fail-under=100 | ||
- name: Upload HTML report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: html-report | ||
path: htmlcov |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,36 @@ | ||
--- | ||
# See https://pre-commit.com for more information | ||
default_language_version: | ||
python: python3.10 | ||
python: python3.9 | ||
|
||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: 'https://github.com/pre-commit/pre-commit-hooks' | ||
rev: v4.4.0 | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude: '(notebooks|attic|benchmark|testdata)/.*' | ||
- id: end-of-file-fixer | ||
exclude: LICENSE | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: check-added-large-files | ||
args: | ||
- '--maxkb=1024' | ||
- id: debug-statements | ||
- id: detect-private-key | ||
- id: mixed-line-ending | ||
args: | ||
- '--fix=lf' | ||
- id: check-docstring-first | ||
- id: check-case-conflict # Check for files with names that would conflict on a case-insensitive filesystem | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
exclude: '(notebooks|attic|benchmark|testdata)/.*' | ||
- repo: 'https://github.com/psf/black' | ||
rev: 23.1.0 | ||
rev: 23.11.0 | ||
hooks: | ||
- id: black | ||
exclude: '(notebooks|attic|benchmark|testdata)/.*' | ||
# - repo: https://github.com/jazzband/pip-tools | ||
# rev: 6.12.3 | ||
# hooks: | ||
# - id: pip-compile | ||
# args: | ||
# - '--resolver=backtracking' |
This file contains 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
This file contains 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
Oops, something went wrong.