diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cf7a39f..267ce6b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,3 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..a597eb5 --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,133 @@ +name: py-ga-mob + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + release: + types: [created] + schedule: + - cron: '1 3 * * 1' + +jobs: + analyze: + name: Analyze + if: github.event_name != 'release' + runs-on: ubuntu-latest + + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 + + build: + name: CI + if: ${{ github.event_name != 'release' || github.event_name != 'schedule' }} + runs-on: ubuntu-latest + strategy: + matrix: + language: [ 'python' ] + python-version: [3.6, 3.7, 3.8, 3.9] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache pip artifacts + uses: actions/cache@v2 + with: + # This path is specific to Ubuntu + path: ~/.cache/pip + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python setup.py install + + #- name: Audit + # run: | + # pylama pyga -i E501 + + - name: Test ${{ matrix.test_number }} + run: | + python setup.py test + # coverage run --source=pyga setup.py test + + #- name: Coveralls Parallel + # uses: coverallsapp/github-action@master + # with: + # github-token: ${{ secrets.github_token }} + # flag-name: run-${{ matrix.test_number }} + # parallel: true + + #finish: + # needs: build + # runs-on: ubuntu-latest + # steps: + # - name: Coveralls Finished + # uses: coverallsapp/github-action@master + # with: + # github-token: ${{ secrets.github_token }} + # parallel-finished: true + + deploy: + name: CD + if: ${{ github.event_name == 'release' && github.event.release.action == 'released' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 38a3f67..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,55 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '1 3 * * */2' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - - run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; - then pip install -r requirements.txt; - fi - # Set the `CODEQL-PYTHON` environment variable to the Python executable - # that includes the dependencies - echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index e302d50..0000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Cache pip - uses: actions/cache@v2 - with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install pylama coveralls - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python setup.py install - #- name: Audit - # run: | - # pylama pyga -i E501 - - name: Test ${{ matrix.test_number }} - run: | - python setup.py test - # coverage run --source=pyga setup.py test - #- name: Coveralls Parallel - # uses: coverallsapp/github-action@master - # with: - # github-token: ${{ secrets.github_token }} - # flag-name: run-${{ matrix.test_number }} - # parallel: true - - #finish: - # needs: build - # runs-on: ubuntu-latest - # steps: - # - name: Coveralls Finished - # uses: coverallsapp/github-action@master - # with: - # github-token: ${{ secrets.github_token }} - # parallel-finished: true - diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 1a03a7b..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/.gitignore b/.gitignore index 0dedaf2..5ee3326 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ *pyc -dist -build *.egg-info *.egg -doc/_build *~ .ropeproject .vimrc +.coverage .eggs/ +doc/_build +dist +build +.pytest_cache \ No newline at end of file diff --git a/setup.py b/setup.py index 91e1529..2eb2160 100755 --- a/setup.py +++ b/setup.py @@ -36,5 +36,5 @@ 'Topic :: Internet :: WWW/HTTP :: WSGI', ], test_suite='tests', - tests_require=['mock',] + tests_require=['mock', 'python-coveralls'] )