From bfaaee36fe413844f5a4bdf0602fc2d514b692fb Mon Sep 17 00:00:00 2001 From: Dipika Sikka Date: Wed, 3 Apr 2024 14:27:30 +0000 Subject: [PATCH] small refactor --- .github/actions/build-wheel/action.yml | 54 +++++++++++++++++++ .../workflows/build-wheel-and-container.yml | 35 ++++-------- 2 files changed, 65 insertions(+), 24 deletions(-) create mode 100644 .github/actions/build-wheel/action.yml diff --git a/.github/actions/build-wheel/action.yml b/.github/actions/build-wheel/action.yml new file mode 100644 index 00000000000..c570f223482 --- /dev/null +++ b/.github/actions/build-wheel/action.yml @@ -0,0 +1,54 @@ +name: build-whl +on: + workflow_call: + inputs: + build_label: + description: "requested runner label" + type: string + required: true + dev: + type: bool + required: true + release: + type: bool + required: true + name: + type: string + internal: + type: bool + filename: + type: string + required: true + + +jobs: + build: + runs-on: ${{ inputs.build_label }} + outputs: + wheel: ${{ steps.push-wheel.outputs.wheel }} + steps: + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Login to s3 + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_WEBIDENTITY_FOR_GITHUB_ACTIONS }} + aws-region: us-east-1 + + - name: Build PyPi Wheel + id: build-wheel + uses: neuralmagic/nm-actions/actions/pypi_build@main + with: + dev: ${{ inputs.dev }} + release: ${{ inputs.release }} + name: ${{ inputs.name }} + + - name: Push to s3 bucket + id: push-wheel + uses: neuralmagic/nm-actions/actions/s3_push@main + with: + filename: ${{ inputs.filename }} + internal: ${{ inputs.internal }} + diff --git a/.github/workflows/build-wheel-and-container.yml b/.github/workflows/build-wheel-and-container.yml index 70c3013c4c4..267aa9f75d3 100644 --- a/.github/workflows/build-wheel-and-container.yml +++ b/.github/workflows/build-wheel-and-container.yml @@ -34,30 +34,16 @@ env: jobs: build-wheel-and-push: - runs-on: ubuntu-20.04 - outputs: - wheel: ${{ steps.push-wheel.outputs.wheel }} - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Login to s3 - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ secrets.AWS_WEBIDENTITY_FOR_GITHUB_ACTIONS }} - aws-region: us-east-1 - - name: Build PyPi Wheel - id: build-wheel - uses: neuralmagic/nm-actions/actions/pypi_build@main - with: - dev: $DEV - release: $RELEASE - name: $NAME - - name: Push to s3 bucket - id: push-wheel - uses: neuralmagic/nm-actions/actions/s3_push@main - with: - filename: dist/*.whl - internal: $INTERNAL + uses: ./.github/actions/build-wheel/ + with: + build-label: ubuntu-20.04 + dev: $DEV + release: $RELEASE + name: $NAME + internal: $INTERNAL + filename: dist/*.whl + + pull-wheel-and-test: needs: build-wheel-and-push runs-on: ubuntu-20.04 @@ -89,6 +75,7 @@ jobs: run: | rm -rf src make test + build-container-and-push: needs: pull-wheel-and-test runs-on: [aws-avx2-64G]