Skip to content

Commit

Permalink
Merge branch 'main' into zhb/SortAbs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhb000 committed Mar 29, 2022
2 parents 11b9f30 + e63557f commit 36e47a7
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 9 deletions.
34 changes: 29 additions & 5 deletions .github/workflows/CI-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -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
30 changes: 27 additions & 3 deletions .github/workflows/Ci-raiwigets-python-typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,46 @@ 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()
uses: actions/upload-artifact@v2
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
73 changes: 73 additions & 0 deletions .github/workflows/release-raiutils.yml
Original file line number Diff line number Diff line change
@@ -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/
3 changes: 2 additions & 1 deletion rai_core_flask/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ itsdangerous==2.0.1
greenlet==1.1.2
gevent==21.12.0
markupsafe<2.1.0
jinja2==2.11.3
jinja2==2.11.3
Werkzeug<2.1.0

0 comments on commit 36e47a7

Please sign in to comment.