From d96dad8077c2f1ec4a4c75f2a1f510d5d2ca66b9 Mon Sep 17 00:00:00 2001 From: Ilya Matiach Date: Tue, 29 Mar 2022 01:13:29 -0400 Subject: [PATCH 1/2] add retry logic to codecov step and only upload results for one python version (#1298) --- .github/workflows/CI-python.yml | 34 ++++++++++++++++--- .../Ci-raiwigets-python-typescript.yml | 30 ++++++++++++++-- rai_core_flask/requirements.txt | 3 +- 3 files changed, 58 insertions(+), 9 deletions(-) diff --git a/.github/workflows/CI-python.yml b/.github/workflows/CI-python.yml index cf651c146d..6fa88b2951 100644 --- a/.github/workflows/CI-python.yml +++ b/.github/workflows/CI-python.yml @@ -13,11 +13,11 @@ jobs: packageDirectory: ["rai_core_flask", "responsibleai", "erroranalysis", "raiutils"] operatingSystem: [ubuntu-latest, macos-latest, windows-latest] - pythonVersion: [3.6, 3.7, 3.8, 3.9] + pythonVersion: ["3.6", "3.7", "3.8", "3.9"] exclude: - packageDirectory: "rai_core_flask" operatingSystem: macos-latest - pythonVersion: 3.9 + pythonVersion: "3.9" runs-on: ${{ matrix.operatingSystem }} @@ -74,15 +74,39 @@ jobs: # Use always() to always run this step to publish test results when there are test failures if: ${{ always() }} - - name: Upload coverage to Codecov + - if: ${{ (matrix.operatingSystem == 'ubuntu-latest') && (matrix.pythonVersion == '3.7') }} + name: Upload to codecov + id: codecovupload1 uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }} directory: ${{ matrix.packageDirectory }} env_vars: OS,PYTHON - fail_ci_if_error: true + fail_ci_if_error: false files: ./${{ matrix.packageDirectory }}/coverage.xml flags: unittests name: codecov-umbrella verbose: true - if: ${{ always() }} + + - if: ${{ (steps.codecovupload1.outcome == 'failure') && (matrix.pythonVersion == '3.7') && (matrix.operatingSystem == 'ubuntu-latest') }} + name: Retry upload to codecov + id: codecovupload2 + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: ${{ matrix.packageDirectory }} + env_vars: OS,PYTHON + fail_ci_if_error: false + files: ./${{ matrix.packageDirectory }}/coverage.xml + flags: unittests + name: codecov-umbrella + verbose: true + + - name: Set codecov status + if: ${{ (matrix.pythonVersion == '3.7') && (matrix.operatingSystem == 'ubuntu-latest') }} + run: | + if ${{ (steps.codecovupload1.outcome == 'success') || (steps.codecovupload2.outcome == 'success') }} ; then + echo fine + else + exit 1 + fi diff --git a/.github/workflows/Ci-raiwigets-python-typescript.yml b/.github/workflows/Ci-raiwigets-python-typescript.yml index 35b724d1e4..dc43a5109f 100644 --- a/.github/workflows/Ci-raiwigets-python-typescript.yml +++ b/.github/workflows/Ci-raiwigets-python-typescript.yml @@ -106,18 +106,33 @@ jobs: # Use always() to always run this step to publish test results when there are test failures if: ${{ always() }} - - name: Upload coverage to Codecov + - if: ${{ (matrix.operatingSystem == 'ubuntu-latest') && (matrix.pythonVersion == '3.7') }} + name: Upload to codecov + id: codecovupload1 uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }} directory: ${{ matrix.packageDirectory }} env_vars: OS,PYTHON - fail_ci_if_error: true + fail_ci_if_error: false + files: ./${{ matrix.packageDirectory }}/coverage.xml + flags: unittests + name: codecov-umbrella + verbose: true + + - if: ${{ (steps.codecovupload1.outcome == 'failure') && (matrix.pythonVersion == '3.7') && (matrix.operatingSystem == 'ubuntu-latest') }} + name: Retry upload to codecov + id: codecovupload2 + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: ${{ matrix.packageDirectory }} + env_vars: OS,PYTHON + fail_ci_if_error: false files: ./${{ matrix.packageDirectory }}/coverage.xml flags: unittests name: codecov-umbrella verbose: true - if: ${{ always() }} - name: Upload e2e test screen shot if: always() @@ -125,3 +140,12 @@ jobs: with: name: ${{ matrix.packageDirectory }}-e2e-screen-shot path: dist/cypress + + - name: Set codecov status + if: ${{ (matrix.pythonVersion == '3.7') && (matrix.operatingSystem == 'ubuntu-latest') }} + run: | + if ${{ (steps.codecovupload1.outcome == 'success') || (steps.codecovupload2.outcome == 'success') }} ; then + echo fine + else + exit 1 + fi diff --git a/rai_core_flask/requirements.txt b/rai_core_flask/requirements.txt index f3ca525dc4..faf872ca7b 100644 --- a/rai_core_flask/requirements.txt +++ b/rai_core_flask/requirements.txt @@ -6,4 +6,5 @@ itsdangerous==2.0.1 greenlet==1.1.2 gevent==21.12.0 markupsafe<2.1.0 -jinja2==2.11.3 \ No newline at end of file +jinja2==2.11.3 +Werkzeug<2.1.0 \ No newline at end of file From e63557f7192acef9e93377297688ff7bcdad4a21 Mon Sep 17 00:00:00 2001 From: Ilya Matiach Date: Tue, 29 Mar 2022 08:23:42 -0400 Subject: [PATCH 2/2] add github action to release raiutils to pypi (#1294) --- .github/workflows/release-raiutils.yml | 73 ++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/release-raiutils.yml diff --git a/.github/workflows/release-raiutils.yml b/.github/workflows/release-raiutils.yml new file mode 100644 index 0000000000..85e540daa3 --- /dev/null +++ b/.github/workflows/release-raiutils.yml @@ -0,0 +1,73 @@ +name: Release raiutils to PyPI + +# trigger manually only ("collaborator" or more permissions required) +on: + workflow_dispatch: + inputs: + type: + description: "Test or Prod PyPI?" + required: true + default: "Test" + +jobs: + release-raiutils: + runs-on: ubuntu-latest + steps: + - name: fail if Test nor Prod + if: ${{ ! (github.event.inputs.type == 'Test' || github.event.inputs.type == 'Prod') }} + run: | + echo "Only Test or Prod can be used." + exit 1 + + # build wheel + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + + - name: update and upgrade pip, setuptools, wheel, and twine + run: | + python -m pip install --upgrade pip + pip install --upgrade setuptools wheel twine + + - name: install requirements.txt for raiutils + run: | + pip install -r requirements.txt + pip install -r requirements-dev.txt + working-directory: raiutils + + - name: pip freeze + run: pip freeze + + - name: build wheel for raiutils + run: python setup.py sdist bdist_wheel + working-directory: raiutils + + # run tests before publishing to PyPI + + - name: install raiutils wheel locally + run: find ./dist/ -name '*.whl' -exec pip install {} \; + working-directory: raiutils + + - name: run raiutils tests + run: pytest ./tests/ + working-directory: raiutils + + # publish to PyPI + - name: Publish raiutils package to Test PyPI + if: ${{ github.event.inputs.type == 'Test' }} + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN_RAIUTILS }} + repository_url: https://test.pypi.org/legacy/ + packages_dir: raiutils/dist/ + - name: Publish raiutils package to PyPI + if: ${{ github.event.inputs.type == 'Prod' }} + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN_RAIUTILS }} + packages_dir: raiutils/dist/