Skip to content

Commit

Permalink
unify actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kra3 committed May 9, 2021
1 parent 8b78667 commit ba47e6f
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 144 deletions.
133 changes: 133 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: ci/cd

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' ]
python-version: [3.6, 3.7, 3.8, 3.9]

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:
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/*
51 changes: 0 additions & 51 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

62 changes: 0 additions & 62 deletions .github/workflows/python-package.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/python-publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
'Topic :: Internet :: WWW/HTTP :: WSGI',
],
test_suite='tests',
tests_require=['mock',]
tests_require=['mock', 'python-coveralls']
)

0 comments on commit ba47e6f

Please sign in to comment.