Skip to content

dbarbuzzi uploading whl/tar.gz from run 12459165696 #2

dbarbuzzi uploading whl/tar.gz from run 12459165696

dbarbuzzi uploading whl/tar.gz from run 12459165696 #2

Workflow file for this run

name: upload compressed-tensors whl and tar.gz
run-name: ${{ github.actor }} uploading whl/tar.gz from run ${{ inputs.run_id }}
on:
workflow_call:
inputs:
label:
description: "requested runner label (specifies instance)"
type: string
required: true
timeout:
description: "time limit for run in minutes "
type: string
required: true
run_id:
description: "run_id of 'build.yml' run that generated the assets"
type: string
required: true
push_to_pypi:
description: "push asset to public pypi."
type: boolean
default: false
testmo_run_id:
description: "testmo run id"
type: string
default: ''
workflow_dispatch:
inputs:
label:
description: "requested runner label (specifies instance)"
type: string
required: true
timeout:
description: "time limit for run in minutes "
type: string
required: true
run_id:
description: "run_id of 'build.yml' run that generated the assets"
type: string
required: true
push_to_pypi:
description: "push asset to public pypi."
type: boolean
default: false
testmo_run_id:
description: "testmo run id"
type: string
default: ''
jobs:
UPLOAD:
runs-on: ${{ inputs.label }}
timeout-minutes: ${{ fromJson(inputs.timeout) }}
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: install automation components
uses: neuralmagic/nm-actions/actions/install-automation-components@v1.0.0
- name: set python
id: set-python
uses: actions/setup-python@v5
with:
python-version: 3.10.12
- name: complete testmo run
uses: neuralmagic/nm-actions/actions/testmo-run-complete@v1.11.0
if: (success() || failure()) && inputs.testmo_run_id != ''
with:
testmo_url: https://neuralmagic.testmo.net
testmo_token: ${{ secrets.TESTMO_TEST_TOKEN }}
testmo_run_id: ${{ inputs.testmo_run_id }}
# GCP
- name: 'Authenticate to Google Cloud'
id: auth-gcp
uses: google-github-actions/auth@v2.1.3
with:
project_id: ${{ secrets.GCP_PROJECT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_GHA_SA }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 473.0.0'
- name: download assets
uses: neuralmagic/nm-actions/actions/gcp-download-assets@v1.1.0
with:
bucket_source: ${{ secrets.GCP_BUILD_ML_ASSETS2 }}
run_id: ${{ inputs.run_id }}
# GCP
- name: 'Authenticate to Google Cloud'
id: auth-pypi
uses: google-github-actions/auth@v2.1.3
with:
project_id: ${{ secrets.GCP_PROJECT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.NM_PYPI_SA }}
- name: find whl
id: find-asset-whl
uses: neuralmagic/nm-actions/actions/find-asset@v1.1.0
with:
run_id: ${{ inputs.run_id }}
asset_identifier: 'compressed*.whl'
- name: upload whl to "nm-pypi"
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/gcp-upload-asset@v1.1.0
with:
bucket_target: ${{ secrets.GCP_NM_PYPI_DIST }}
asset: ${{ steps.find-asset-whl.outputs.asset }}
- name: find tar.gz
id: find-asset-targz
uses: neuralmagic/nm-actions/actions/find-asset@v1.1.0
with:
run_id: ${{ inputs.run_id }}
asset_identifier: 'compressed*.tar.gz'
- name: upload tar.gz to "nm-pypi"
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/gcp-upload-asset@v1.1.0
with:
bucket_target: ${{ secrets.GCP_NM_PYPI_DIST }}
asset: ${{ steps.find-asset-targz.outputs.asset }}
- name: update "nm-pypi" index
uses: actions/github-script@v6
with:
github-token: ${{ secrets.CICD_GITHUB_PAT }}
script: |
const result = await github.rest.actions.createWorkflowDispatch({
owner: 'neuralmagic',
repo: 'stratus',
workflow_id: 'nm-pypi-update.yml',
ref: 'main'
})
console.log(result)
# publish the wheel file to public pypi
- name: push wheel to pypi.org
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ steps.find-asset-whl.outputs.asset }}
# publish the tar.gz file to public pypi
- name: push wheel to pypi.org
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ steps.find-asset-targz.outputs.asset }}