Skip to content

Build PyPi Wheel and Docker Container #917

Build PyPi Wheel and Docker Container

Build PyPi Wheel and Docker Container #917

name: Build PyPi Wheel and Docker Container
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
schedule:
- cron: '0 20 * * *'
permissions:
id-token: write
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# TODO: do we want to push to nightly everytime we push to main?
# if not dev or release, will create a nightly build; turning off release for now
env:
RELEASE: 'false'
DEV: ${{ github.base_ref == 'main' && github.event_name == 'pull_request'}}
jobs:
set-outputs:
runs-on: ubuntu-latest
outputs:
dev: ${{ steps.set-outputs.outputs.dev }}
release: ${{ steps.set-outputs.outputs.release }}
steps:
- name: Set variables for workflows
id: set-outputs
run: |
echo "dev=$DEV" >> $GITHUB_OUTPUT
echo "release=$RELEASE" >> $GITHUB_OUTPUT
test-nightly:
needs: set-outputs
if: ${{ needs.set-outputs.outputs.dev == 'false' && needs.set-outputs.outputs.release == 'false'}}
uses: ./.github/workflows/test-nightly.yml
build-wheel-and-push:
needs: [set-outputs, test-nightly]
if: ${{ always() && needs.set-outputs.outputs.dev == 'false' && needs.test-nightly.result == 'success' || always() && needs.set-outputs.outputs.dev == 'true' && needs.set-outputs.result == 'success' }}
uses: ./.github/workflows/build-wheel.yml
with:
build-label: ubuntu-20.04
dev: ${{ needs.set-outputs.outputs.dev }}
release: ${{ needs.set-outputs.outputs.release }}
name: ${{ github.event.number }}
filename: dist/*.whl
bucket_name: nm-actions-test
python: '3.10'
secrets: inherit
test-wheel-and-publish:
needs: [set-outputs, build-wheel-and-push]
if: ${{ always() && !cancelled() && needs.build-wheel-and-push.result == 'success' }}
uses: ./.github/workflows/test-wheel-and-publish.yml
with:
build-label: ubuntu-20.04
whl: ${{ needs.build-wheel-and-push.outputs.wheel }}
python: '3.10'
dev: ${{ needs.set-outputs.outputs.dev }}
release: ${{ needs.set-outputs.outputs.release }}
secrets: inherit
build-container-and-push:
needs: [test-wheel-and-publish, set-outputs]
if: ${{ always() && !cancelled() && needs.test-wheel-and-publish.result == 'success' }}
uses: ./.github/workflows/build-container.yml
with:
build-label: k8s-eng-gpu-16G-t4-32G
dev: ${{ needs.set-outputs.outputs.dev }}
release: ${{ needs.set-outputs.outputs.release }}
name: ${{ github.event.number }}
secrets: inherit