From 32ae3c5274f1a11c42d1f5172ec49ff68eb4e27d Mon Sep 17 00:00:00 2001 From: Andrey Shpak Date: Sun, 7 Jun 2020 14:22:52 +0300 Subject: [PATCH 1/3] Split linting stage from main Github CI/CD --- .github/workflows/linting.yml | 36 +++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 8 -------- 2 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/linting.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 00000000..3bb16213 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,36 @@ +name: Linting Tests +# Only for last versions of python + +on: + push: + branches: + - master + tags: + - "*" + pull_request: + branches: + - "*" + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - name: "linting" + python: "3.8" + os: ubuntu-latest + tox_env: "lint" + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox virtualenv + - name: Test build + run: "tox -e ${{ matrix.tox_env }}" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ae903ebc..f899e1ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,19 +12,11 @@ on: jobs: build: - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: mongodb-version: [3.6, 4.0, 4.2] - include: - - name: "linting" - python: "3.8" - os: ubuntu-latest - tox_env: "lint" - mongodb-version: 4.2 - - name: "ubuntu-py36" python: "3.6" os: ubuntu-latest From f03217bff093df545ea0395110dea25f32af4f41 Mon Sep 17 00:00:00 2001 From: Andrey Shpak Date: Sun, 7 Jun 2020 14:23:17 +0300 Subject: [PATCH 2/3] Add Github CI/CD coverage stage --- .github/workflows/coverage.yml | 52 ++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ tox.ini | 2 +- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..dfedd3cc --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,52 @@ +name: Send Coverage to different analitic engines +# Only for last versions of python and mongo + +on: + push: + branches: + - master + tags: + - "*" + pull_request: + branches: + - "*" + +jobs: + build: + strategy: + fail-fast: false + matrix: + mongodb-version: [4.2] + include: + - name: "coverage" + python: "3.8" + os: ubuntu-latest + tox_env: "py38" + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox virtualenv + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.3.0 + with: + mongodb-version: ${{ matrix.mongodb-version }} + - name: Test build + run: "tox -e ${{ matrix.tox_env }} -- --cov-report=xml --cov-report=html" + - name: Send coverage report to codecov + uses: codecov/codecov-action@v1 + with: + file: ./coverage.xml + - name: Send coverage report to codeclimate + uses: paambaati/codeclimate-action@v2.6.0 + with: + coverageCommand: echo "Ignore rerun" + coverageLocations: ${{github.workspace}}/coverage.xml:coverage.py + env: + CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}} diff --git a/.gitignore b/.gitignore index 680ad123..f1f17873 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ venv/ .eggs .idea .vscode +htmlcov/ +coverage.xml diff --git a/tox.ini b/tox.ini index 918f6763..6a3a3327 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist = {py36,py37,py38,pypy3},lint [testenv] commands = - python -m pytest + python -m pytest {posargs} deps = PyMongo>3.9.0 pytest From 3529c80cfe3892debf3f837c73f213a3940a1ddc Mon Sep 17 00:00:00 2001 From: Andrey Shpak Date: Sun, 7 Jun 2020 14:31:30 +0300 Subject: [PATCH 3/3] Fix yaml error --- .github/workflows/coverage.yml | 4 ++-- .github/workflows/linting.yml | 4 ++-- .github/workflows/main.yml | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index dfedd3cc..eca4871c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,7 +12,8 @@ on: - "*" jobs: - build: + coverage: + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -20,7 +21,6 @@ jobs: include: - name: "coverage" python: "3.8" - os: ubuntu-latest tox_env: "py38" steps: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 3bb16213..66c35948 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,14 +12,14 @@ on: - "*" jobs: - build: + linting: + runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - name: "linting" python: "3.8" - os: ubuntu-latest tox_env: "lint" steps: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f899e1ea..43d9800f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,7 @@ on: jobs: build: + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -19,19 +20,15 @@ jobs: include: - name: "ubuntu-py36" python: "3.6" - os: ubuntu-latest tox_env: "py36" - name: "ubuntu-py37" python: "3.7" - os: ubuntu-latest tox_env: "py37" - name: "ubuntu-py38" python: "3.8" - os: ubuntu-latest tox_env: "py38" - name: "ubuntu-pypy3" python: "pypy3" - os: ubuntu-latest tox_env: "pypy3" steps: