Skip to content

Commit

Permalink
Merge: feature/basic-functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSasser committed Jan 15, 2021
2 parents 784533e + 11e1830 commit b0f5f02
Show file tree
Hide file tree
Showing 63 changed files with 18,615 additions and 2,897 deletions.
10 changes: 10 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1

test_patterns = ["*/tests/**"]

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# ds2000 - The Python Library for Rigol DS2000 Oscilloscopes
# Copyright (c) 2020 Michael Sasser <Michael@MichaelSasser.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
name: Python CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master, develop ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Project Dependencies
run: poetry install -E docs
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

- name: Run pre-commit
run: |
source .venv/bin/activate
pre-commit run --all-files
- name: Sphinx Build
working-directory: ./docs
run: |
source ../.venv/bin/activate
make html
- name: Test with pytest
run: |
source .venv/bin/activate
poetry run pytest
64 changes: 64 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# ds2000 - The Python Library for Rigol DS2000 Oscilloscopes
# Copyright (c) 2020 Michael Sasser <Michael@MichaelSasser.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
---
name: github pages

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
env:
working-directory: ./docs
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Project Dependencies
run: poetry install -E docs
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

- name: Make docs
working-directory: ${{env.working-directory}}
run: |
source ../.venv/bin/activate
make html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html/
27 changes: 0 additions & 27 deletions .github/workflows/pythonpackage.yml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# ds2000 - The Python Library for Rigol DS2000 Oscilloscopes
# Copyright (c) 2020 Michael Sasser <Michael@MichaelSasser.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
---
name: Upload Release Asset

on:
push:
tags:
- "v*"

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Build project
run: poetry build

- name: pypi-publish
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
# PyPI user
# user: # optional, default is __token__
# Password for your PyPI user or an access token
password: ${{ secrets.pypi_token }}
# The repository URL to use
# repository_url: # optional
# The target directory for distribution
# packages_dir: # optional, default is dist

- name: Zip project
run: zip --junk-paths ds2000.zip dist/* README.md LICENSE.txt

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: true

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ds2000.zip
asset_name: ds2000.zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
!.gitignore
oscilloscope.py
setup.py
# Created by .ignore support plugin (hsz.mobi)
### Emacs template
Expand Down Expand Up @@ -349,4 +350,3 @@ ENV/
.dropbox
.dropbox.attr
.dropbox.cache

122 changes: 122 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
minimum_pre_commit_version: 2.6.0
# default_language_version:
# python: python3.8
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

# pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
# Simply check whether files parse as valid python.
- id: check-ast
# Require literal syntax when initializing empty or zero Python builtin
# types.
- id: check-builtin-literals
# Forbid files which have a UTF-8 byte-order marker
- id: check-byte-order-marker
# Check for files with names that would conflict on a case-insensitive
# filesystem like MacOS HFS+ or Windows FAT.
- id: check-case-conflict
# Checks for a common error of placing code before the docstring.
- id: check-docstring-first
# check-executables-have-shebangs
#- id: check-executables-have-shebangs
# Attempts to load all json files to verify syntax.
# - id: check-json
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Checks for symlinks which do not point to anything.
# - id: check-symlinks
# Attempts to load all TOML files to verify syntax.
- id: check-toml
# Ensures that links to vcs websites are permalinks.
- id: check-vcs-permalinks
# Attempts to load all xml files to verify syntax.
# - id: check-xml
# Attempts to load all yaml files to verify syntax.
- id: check-yaml
# Check for debugger imports and breakpoint() calls in python source.
- id: debug-statements
# Checks for the existence of AWS secrets, set up with the AWS CLI.
# - id: detect-aws-credentials
# Checks for the existence of private keys.
- id: detect-private-key
# This hook replaces double quoted strings with single quoted strings.
# - id: double-quote-string-fixer (KEEP DISABLED)
# Makes sure files end in a newline and only a newline.
- id: end-of-file-fixer
# Removes "# -*- coding: utf-8 -*-" on the top of python files.
- id: fix-encoding-pragma
args: [ "--remove" ]
# Sort the lines in specified files (defaults to alphabetical).
# - id: file-contents-sorter (KEEP DISABLED)
# Replaces or checks mixed line ending to LF.
- id: mixed-line-ending
args: [ "--fix=lf" ]
# Assert that files in tests/ match test*.py.
- id: name-tests-test
args: [ "--django" ]
# Protect specific branches from direct checkins.
- id: no-commit-to-branch
args:
- "-b master"
- "-p release/v.*"
# Checks that all your JSON files are pretty.
# - id: pretty-format-json
# args: ["--autofix"]
# Sorts entries in requirements.txt and removes incorrect entry
# - id: requirements-txt-fixer (KEEP DISABLED)
# Sorts simple YAML files which consist only of top-level keys,
# preserving comments and blocks.
# - id: sort-simple-yaml (KEEP DISABLED)
# Trims trailing whitespace.
- id: trailing-whitespace
# - id: flake8
# additional_dependencies: ["flake8-bugbear"]
# reorder imports
# - repo: https://github.com/asottile/reorder_python_imports
# rev: v2.2.0
# hooks:
# - id: reorder-python-imports
# additional_dependencies: [toml]
# exclude: ^.*/?setup\.py$

# isort
- repo: https://github.com/timothycrosley/isort
rev: 5.6.4
hooks:
- id: isort
additional_dependencies: [ toml ]

# format: black
- repo: https://github.com/ambv/black
rev: 20.8b1
hooks:
- id: black

# flake8
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
additional_dependencies: [ "flake8-bugbear" ]

# check docstrings
- repo: https://github.com/PyCQA/pydocstyle
rev: 5.1.1
hooks:
- id: pydocstyle
args: [ "--ignore=D10,D21,D202" ]

# static type checking with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
hooks:
- id: mypy

0 comments on commit b0f5f02

Please sign in to comment.