Skip to content

upgrade nx to 12.10.0 (#2561) #749

upgrade nx to 12.10.0 (#2561)

upgrade nx to 12.10.0 (#2561) #749

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
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
#setup environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
- id: publish_url_for_js
name: publish_url_for_js
run: |
if [[ '${{ github.event_name }}' == 'push' ]]
then
echo "url=https://${blob_account}.blob.core.windows.net/${blob_container_for_js}/index.html" >> $GITHUB_OUTPUT
elif [[ '${{ github.event_name }}' == 'pull_request' ]]
then
echo "url=https://${blob_account}.blob.core.windows.net/${blob_container_for_pull_request}/${blob_path_for_pull_request}/${dashboardDirectory}/index.html" >> $GITHUB_OUTPUT
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 "version=$(cat version.cfg)" >> $GITHUB_OUTPUT
- 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: Install rai_test_utils locally until next version is released
run: |
pip install -v -e .
working-directory: rai_test_utils
- 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 -s -v --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/cli@v1.0.0
id: uploaddashboard
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
continue-on-error: true
- if: ${{ (github.event_name == 'pull_request') && (steps.uploaddashboard.outcome != 'failure') }}
uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: ${{steps.publish_url_for_js.outputs.url}}
check_for_duplicate_msg: true
- if: ${{ (steps.uploaddashboard.outcome != 'failure') }}
name: Upload responsible-ai
uses: Azure/cli@v1.0.0
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
- if: ${{ (steps.uploaddashboard.outcome != 'failure') }}
name: Upload raiwidgets
uses: Azure/cli@v1.0.0
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 "date=$(date --date='${{env.retentionDays}} days ago' +'%Y-%m-%dT00:00Z')" >> $GITHUB_OUTPUT
- if: ${{ (steps.uploaddashboard.outcome != 'failure') }}
name: Delete old files before ${{steps.retention_date.outputs.date}}
uses: Azure/cli@v1.0.0
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@v4
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 }}"