diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 0a7c51ae..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,209 +0,0 @@ -.common-values: - - docker-image: &docker-image circleci/python:3.6 - - docker-image-python39: &docker-image-python39 circleci/python:3.9 - - working_directory: &working-directory ~/repo - - # Download and cache dependencies - restore-cache: &restore-cache - keys: - - v1-dependencies-{{ checksum "requirements.txt" }} - - create-venv: &create-venv - name: Create virtualenv - command: . scripts/create_venv.sh - - save-cache: &save-cache - paths: - - ./venv - key: v1-dependencies-{{ checksum "requirements.txt" }} - - install-package: &install-package - name: Install package - command: | - . scripts/helpers.sh - install_package [devel] - - install-pandoc: &install-pandoc - name: Install pandoc - command: sudo apt-get install pandoc - -.master-branch-filter: &master-branch-filter - filters: - branches: - ignore: master - -.requires-lint: &requires-lint - requires: - - lint - <<: *master-branch-filter - -.tags-only-filter: &tags-only-filter - filters: - branches: - ignore: /.*/ - tags: - only: /.*/ - -.requires-build: &requires-build - requires: - - build - <<: *tags-only-filter - -.lint-steps: &lint-steps - docker: - - image: *docker-image - working_directory: *working-directory - steps: - - checkout - - restore_cache: *restore-cache - - run: *create-venv - - run: - name: Check code style (PEP8) - command: . scripts/lint.sh - - save_cache: *save-cache - -.test-steps: &test-steps - docker: - - image: *docker-image - working_directory: *working-directory - steps: - - checkout - - restore_cache: *restore-cache - - run: *create-venv - - save_cache: *save-cache - - run: *install-package - - run: - name: Run tests - command: . scripts/run_tests.sh - -.test-steps-python39: &test-steps-python39 - << : *test-steps - docker: - - image: *docker-image-python39 - -.pip-check: &pip-check - docker: - - image: *docker-image - working_directory: *working-directory - steps: - - checkout - - restore_cache: *restore-cache - - run: *create-venv - - save_cache: *save-cache - - run: *install-package - - run: - name: Run pip check - command: | - . scripts/helpers.sh - activate_venv - pip check - -.build: &build - docker: - - image: *docker-image - working_directory: *working-directory - steps: - - checkout - - restore_cache: *restore-cache - - run: *create-venv - - save_cache: *save-cache - - run: - name: Build package - command: . scripts/build.sh - - persist_to_workspace: - root: ~/repo - paths: - - dist - -.build-docs: &build-docs - docker: - - image: *docker-image - working_directory: *working-directory - steps: - - checkout - - restore_cache: *restore-cache - - run: *create-venv - - save_cache: *save-cache - - run: *install-pandoc - - run: *install-package - - run: - name: Build documentation - command: . scripts/build_docs.sh - -.release: &release - docker: - - image: *docker-image - working_directory: *working-directory - steps: - - attach_workspace: - at: /tmp/package - - checkout - - restore_cache: *restore-cache - - run: *create-venv - - save_cache: *save-cache - - run: - name: init .pypirc - command: . scripts/init_pypirc.sh - - run: - name: Release package - command: . scripts/release.sh /tmp/package/dist - -.type-check: &type-check - docker: - - image: *docker-image - working_directory: *working-directory - steps: - - checkout - - restore_cache: *restore-cache - - run: *create-venv - - save_cache: *save-cache - - run: *install-package - - run: - name: Run type tests - command: . scripts/run_type_check.sh - -version: 2 -jobs: - lint: - <<: *lint-steps - test: - <<: *test-steps - test-python39: - <<: *test-steps-python39 - pip-check: - <<: *pip-check - build: - <<: *build - build-docs: - <<: *build-docs - release: - <<: *release - type-check: - <<: *type-check - - -workflows: - version: 2 - test-all: - jobs: - - lint: - <<: *master-branch-filter - - test: - <<: *requires-lint - - test-python39: - <<: *requires-lint - - pip-check: - <<: *requires-lint - - type-check: - <<: *requires-lint - - build-docs: - <<: *requires-lint - build-and-release: - jobs: - - build: - <<: *tags-only-filter - - release: - <<: *requires-build diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 00000000..b38df29f --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 00000000..95842883 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,62 @@ +name: build-and-release + +on: + push: + tags: + - "**" + +jobs: + build: + name: Build package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.6" + architecture: x64 + - name: Restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashFiles('requirements.txt') }} + - name: Create virtual environment + run: . scripts/create_venv.sh + - name: Build package + run: . scripts/build.sh + - name: Store build artifacts + uses: actions/upload-artifact@v2 + with: + name: stored-package + path: dist + release: + name: Release package + runs-on: ubuntu-latest + needs: + - "build" + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.6" + architecture: x64 + - name: Restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashFiles('requirements.txt') }} + - name: Create virtual environment + run: . scripts/create_venv.sh + - name: Init .pypirc + env: + PYPI_USER: ${{ secrets.PYPI_USER }} + PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: . scripts/init_pypirc.sh + - name: Download a single artifact + uses: actions/download-artifact@v2 + with: + name: stored-package + - name: Release package + run: . scripts/release.sh dist diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 00000000..04ebd197 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,143 @@ +name: Code Quality Checks + +on: + push: + branches-ignore: + - "master" +jobs: + lint: + name: Linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.6" + architecture: x64 + - name: Restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashFiles('requirements.txt') }} + - name: Create virtual environment + run: . scripts/create_venv.sh + - name: Check code style + run: . scripts/lint.sh + test: + name: run tests in python3.9 + needs: + - "lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up python + uses: actions/setup-python@v2 + with: + python-version: "3.6" + architecture: x64 + - name: restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashfiles('requirements.txt') }} + - name: create virtual environment + run: . scripts/create_venv.sh + - name: install package + run: . scripts/helpers.sh && install_package [devel] + - name: run tests + run: . scripts/run_tests.sh + test-py39: + name: run tests + needs: + - "lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + architecture: x64 + - name: restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashfiles('requirements.txt') }} + - name: create virtual environment + run: . scripts/create_venv.sh + - name: install package + run: . scripts/helpers.sh && install_package [devel] + - name: run tests + run: . scripts/run_tests.sh + type-check: + name: Mypy check + needs: + - "lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.6" + architecture: x64 + - name: Restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashFiles('requirements.txt') }} + - name: Create virtual environment + run: . scripts/create_venv.sh + - name: Install package + run: . scripts/helpers.sh && install_package [devel] + - name: Run type checking + run: . scripts/run_type_check.sh + pip-check: + name: Pip check + needs: + - "lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.6" + architecture: x64 + - name: Restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashFiles('requirements.txt') }} + - name: Create virtual environment + run: . scripts/create_venv.sh + - name: Install package + run: . scripts/helpers.sh && install_package [devel] + - name: Run pip check + run: . scripts/helpers.sh && activate_venv && pip check + build-docs: + name: Build documentation + needs: + - "lint" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.6" + architecture: x64 + - name: Restoring cache + uses: actions/cache@v2 + with: + path: ./venv + key: ${{ runner.os }}-python-${{ hashFiles('requirements.txt') }} + - name: Create virtual environment + run: . scripts/create_venv.sh + - name: Install pandoc + run: sudo apt-get install -y -qq pandoc + - name: Install package + run: . scripts/helpers.sh && install_package [devel] + - name: Build documentation + run: . scripts/build_docs.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..7a6017e6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,29 @@ +default_stages: [commit, push] +repos: + - repo: https://github.com/PyCQA/isort + rev: 5.8.0 + hooks: + - id: isort + name: isort (python) + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-added-large-files + - id: debug-statements + - id: double-quote-string-fixer + - id: end-of-file-fixer + - id: mixed-line-ending + - id: check-yaml + - id: requirements-txt-fixer + - id: mixed-line-ending + - id: trailing-whitespace + - repo: https://github.com/pycqa/flake8 + rev: 3.9.2 + hooks: + - id: flake8 + name: flake8 (python) + - repo: https://github.com/myint/docformatter + rev: v1.4 + hooks: + - id: docformatter + args: ["--wrap-descriptions", "0"] diff --git a/scripts/create_venv.sh b/scripts/create_venv.sh index 9260f299..8c837c9d 100644 --- a/scripts/create_venv.sh +++ b/scripts/create_venv.sh @@ -5,7 +5,7 @@ set -e cur_dir=$(dirname ${BASH_SOURCE[0]}) source $cur_dir/helpers.sh -/usr/local/bin/python3 -m venv venv +/usr/bin/env python3 -m venv venv activate_venv