Skip to content

Commit

Permalink
New coverage yaml [API-1273] (#539)
Browse files Browse the repository at this point in the history
New coverage workflow is added
  • Loading branch information
alisengul53 committed Apr 22, 2022
1 parent 9b9dcd5 commit b4e0070
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 41 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/coverage_runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Run tests, measure coverage and upload results to codecov

on:
workflow_dispatch:
inputs:
pr_number:
description: Enter PR number coming from community to run coverage on it. Do not run for PR coming from hazelcast organization, they will be run automatically.
required: true
push:
branches:
- master
- '[45].*.z'
pull_request_target:
branches:
- master
- '[45].*.z'
types:
[opened]

jobs:
check_for_membership:
runs-on: ubuntu-latest
name: Check membership of given user
outputs:
check-result: ${{ steps.composite.outputs.check-result }}
steps:
- name: Action for membership check
id: composite
uses: hazelcast/hazelcast-tpm/membership@main
with:
organization-name: 'hazelcast'
member-name: ${{ github.event.pull_request.head.repo.owner.login }}
token: ${{ secrets.PAT }}

run-tests:
runs-on: ${{ matrix.os }}
needs: [check_for_membership]
if: github.event_name == 'push' || needs.check_for_membership.outputs.check-result == 'true' || github.event_name == 'workflow_dispatch'
name: Run tests with Python ${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
matrix:
python-version: [ '3.6', '3.10' ]
os: [ ubuntu-latest, windows-latest ]
fail-fast: false

steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'

- name: Checkout code for PR
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge

- name: Checkout repository for push event
if: github.event_name == 'push'
uses: actions/checkout@v2

- name: Checkout PR coming from community.
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.inputs.pr_number }}/merge

- name: Install dependencies
run: |
pip install -r requirements-test.txt
- name: Run tests
env:
HAZELCAST_ENTERPRISE_KEY: ${{ secrets.HAZELCAST_ENTERPRISE_KEY }}
run: python run_tests.py

- name: Publish results to Codecov for PR coming from hazelcast organization
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request_target' }}
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
override_pr: ${{ github.event.pull_request.number }}

- name: Publish results to Codecov for Push
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' && github.event_name == 'push' }}
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml

- name: Publish result to Codecov for PR coming from community
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' }}
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
override_pr: ${{ github.event.inputs.pr_number }}

- name: Upload remote controller logs if test run fails
uses: actions/upload-artifact@v2
if: failure()
with:
name: rc-logs-${{ matrix.python-version }}-${{ matrix.os }}
path: |
rc_stderr.log
rc_stdout.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run tests
name: Run linter, generate docs, run mypy
on:
push:
branches:
Expand All @@ -9,45 +9,6 @@ on:
- master
- '[45].*.z'
jobs:
run-tests:
runs-on: ${{ matrix.os }}
name: Run tests with Python ${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
matrix:
python-version: [ '3.6', '3.10' ]
os: [ ubuntu-latest, windows-latest ]
fail-fast: false
steps:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
- name: Checkout to code
uses: actions/checkout@v2
- name: Install dependencies
run: |
pip install -r requirements-test.txt
- name: Run tests
env:
HAZELCAST_ENTERPRISE_KEY: ${{ secrets.HAZELCAST_ENTERPRISE_KEY }}
run: python run_tests.py
- name: Upload remote controller logs on test failure
uses: actions/upload-artifact@v2
if: failure()
with:
name: rc-logs-${{ matrix.python-version }}-${{ matrix.os }}
path: |
rc_stderr.log
rc_stdout.log
- name: Publish results to Codecov
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
run-linter:
runs-on: ubuntu-latest
name: Run black to check the code style
Expand All @@ -56,14 +17,18 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Checkout to code
uses: actions/checkout@v2

- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: Run black
run: |
black --check --config black.toml .
generate_docs:
runs-on: ubuntu-latest
name: Generate documentation
Expand All @@ -72,15 +37,19 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Checkout to code
uses: actions/checkout@v2

- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: Generate documentation
working-directory: docs
run: |
make html SPHINXOPTS="-W --keep-going -b linkcheck"
run-mypy:
runs-on: ubuntu-latest
name: Run mypy to check type annotations
Expand All @@ -89,11 +58,14 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Checkout to code
uses: actions/checkout@v2

- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: Run mypy
run: |
mypy --show-error-codes hazelcast
2 changes: 1 addition & 1 deletion docs/using_python_client_with_hazelcast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ Semaphore data structure has two variations:
they will not be automatically released. You can use the sessionless
CP Semaphore implementation by enabling JDK compatibility
``jdk-compatible`` server-side setting. Refer to `Semaphore configuration
<https://docs.hazelcast.com/hazelcast/latest/cp-subsystem/configuration#semaphore-configuration>`__
<https://docs.hazelcast.com/hazelcast/latest/cp-subsystem/configuration#semaphore-config>`__
documentation for more details.

Using CountDownLatch
Expand Down

0 comments on commit b4e0070

Please sign in to comment.