Skip to content

OD model type support in raiwidgets for EA #7288

OD model type support in raiwidgets for EA

OD model type support in raiwidgets for EA #7288

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CD
env:
folder_to_upload: dist/apps/dashboard
blob_account: responsibleai
blob_container_for_pull_request: pullrequest
blob_container_for_js: latest
blob_container_for_raiwidget: raiwidgets
blob_path_for_pull_request: ${{ github.event.pull_request.head.repo.full_name }}/${{ github.head_ref }}
node-version: 16.x
widgetDirectory: raiwidgets
raiDirectory: responsibleai
dashboardDirectory: dashboard
retentionDays: 90
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
cd-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
#setup environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- id: publish_url_for_js
name: publish_url_for_js
run: |
if [[ '${{ github.event_name }}' == 'push' ]]
then
echo "::set-output name=url::https://${blob_account}.blob.core.windows.net/${blob_container_for_js}/index.html"
elif [[ '${{ github.event_name }}' == 'pull_request' ]]
then
echo "::set-output name=url::https://${blob_account}.blob.core.windows.net/${blob_container_for_pull_request}/${blob_path_for_pull_request}/${dashboardDirectory}/index.html"
else
echo "Invalid event $${{ github.event_name }}"
fi
- name: Install yarn
run: npm install yarn -g
- name: Install
run: yarn install --frozen-lock-file
- name: bump version
run: yarn auto-version
- name: Get version
id: version
run: echo ::set-output name=version::$(cat version.cfg)
- name: Build Typescript
run: yarn buildall
# run tests before publishing to PyPI
- 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 rai
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
working-directory: ${{ env.raiDirectory }}
- name: install requirements.txt for widget
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
working-directory: ${{ env.widgetDirectory }}
- name: pip freeze
run: pip freeze
- name: replace README for raiwidgets
run: |
sed -i 's/(.\/img\//(https:\/\/raw.githubusercontent.com\/microsoft\/responsible-ai-widgets\/main\/img\//g' README.md
cp ./README.md ${{ env.widgetDirectory }}
- name: build wheel for rai
run: python setup.py sdist bdist_wheel
working-directory: ${{ env.widgetDirectory }}
- name: build wheel for widget
run: python setup.py sdist bdist_wheel
working-directory: ${{ env.raiDirectory }}
# run tests before publishing
- name: install wheel locally for rai
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: ${{ env.raiDirectory }}
# run tests before publishing
- name: install wheel locally for widget
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: ${{ env.widgetDirectory }}
- name: run tests
run: pytest --durations=10
- name: Upload a Build result
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
- name: Upload dashboard ${{steps.publish_url_for_js.outputs.url}}
uses: Azure/[email protected]
with:
azcliversion: 2.16.0
inlineScript: |
if [[ '${{ github.event_name }}' == 'push' ]]
then
az storage blob sync -c "${{env.blob_container_for_js}}" --account-name "${{env.blob_account}}" -s "${{env.folder_to_upload}}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
elif [[ '${{ github.event_name }}' == 'pull_request' ]]
then
az storage blob sync -c "${{env.blob_container_for_pull_request}}" --account-name "${{env.blob_account}}" -s "${{env.folder_to_upload}}" -d "${{env.blob_path_for_pull_request}}/${{ env.dashboardDirectory }}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
else
echo "Invalid event $${{ github.event_name }}"
fi
- uses: unsplash/comment-on-pr@master
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: ${{steps.publish_url_for_js.outputs.url}}
check_for_duplicate_msg: true
- name: Upload responsible-ai
uses: Azure/[email protected]
with:
azcliversion: 2.16.0
inlineScript: |
if [[ '${{ github.event_name }}' == 'push' ]]
then
az storage blob sync -c "${{env.blob_container_for_raiwidget}}" --account-name "${{env.blob_account}}" -s "${{ env.raiDirectory }}/dist/" -d "${{steps.version.outputs.version}}/${{ env.raiDirectory }}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
elif [[ '${{ github.event_name }}' == 'pull_request' ]]
then
az storage blob sync -c "${{env.blob_container_for_pull_request}}" --account-name "${{env.blob_account}}" -s "${{ env.raiDirectory }}/dist/" -d "${{env.blob_path_for_pull_request}}/${{ env.raiDirectory }}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
else
echo "Invalid event $${{ github.event_name }}"
fi
- name: Upload raiwidgets
uses: Azure/[email protected]
with:
azcliversion: 2.16.0
inlineScript: |
if [[ '${{ github.event_name }}' == 'push' ]]
then
az storage blob sync -c "${{env.blob_container_for_raiwidget}}" --account-name "${{env.blob_account}}" -s "${{ env.widgetDirectory }}/dist/" -d "${{steps.version.outputs.version}}/${{ env.widgetDirectory }}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
elif [[ '${{ github.event_name }}' == 'pull_request' ]]
then
az storage blob sync -c "${{env.blob_container_for_pull_request}}" --account-name "${{env.blob_account}}" -s "${{ env.widgetDirectory }}/dist/" -d "${{env.blob_path_for_pull_request}}/${{ env.widgetDirectory }}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
else
echo "Invalid event $${{ github.event_name }}"
fi
- name: Get retention cut off date
id: retention_date
run: echo "::set-output name=date::$(date --date='${{env.retentionDays}} days ago' +'%Y-%m-%dT00:00Z')"
- name: Delete old files before ${{steps.retention_date.outputs.date}}
uses: Azure/[email protected]
with:
azcliversion: 2.16.0
inlineScript: |
az storage blob delete-batch --account-name "${{env.blob_account}}" -s "${{env.blob_container_for_raiwidget}}" --if-unmodified-since "${{steps.retention_date.outputs.date}}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
az storage blob delete-batch --account-name "${{env.blob_account}}" -s "${{env.blob_container_for_pull_request}}" --if-unmodified-since "${{steps.retention_date.outputs.date}}" --connection-string="${{secrets.AZURE_STORAGE_CONNECTION_STRING}}"
continue-on-error: true
cd-typescript-publish:
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
needs: cd-build
runs-on: ubuntu-latest
strategy:
matrix:
package:
[
core-ui,
forecasting,
mlchartlib,
dataset-explorer,
causality,
counterfactuals,
fairness,
interpret,
interpret-text,
interpret-vision,
localization,
error-analysis,
model-assessment,
e2e
]
steps:
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- id: download
name: Download a Build Artifact
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- id: publish
name: NPM Publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ${{steps.download.outputs.download-path}}/libs/${{ matrix.package }}/package.json
dry-run: false
access: public
# tag: next
- if: steps.publish.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"