2023-02-07 11:03:59 +00:00
|
|
|
name: Call building packages
|
2022-12-13 05:55:39 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
artifact-name:
|
2023-09-25 12:34:41 +00:00
|
|
|
description: "Unique name for collecting artifacts"
|
2022-12-13 05:55:39 +00:00
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
pkg-names:
|
2023-09-25 12:34:41 +00:00
|
|
|
description: "list package names to be build in json format"
|
2022-12-13 05:55:39 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: |
|
2023-01-04 15:57:18 +00:00
|
|
|
["lightning", "app", "fabric", "pytorch"]
|
2022-12-13 05:55:39 +00:00
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
init:
|
2023-04-24 16:35:46 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-12-13 05:55:39 +00:00
|
|
|
steps:
|
2023-09-25 12:34:41 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- run: |
|
|
|
|
mkdir dist && touch dist/.placeholder
|
|
|
|
- name: Keep artifact
|
|
|
|
id: keep-artifact
|
|
|
|
run: python -c "print('DAYS=' + str(5 if '${{ github.event_name }}'.startswith('pull_request') else 0))" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ inputs.artifact-name }}
|
|
|
|
path: dist
|
|
|
|
retention-days: ${{ steps.keep-artifact.outputs.DAYS }}
|
2022-12-13 05:55:39 +00:00
|
|
|
|
|
|
|
build-packages:
|
|
|
|
needs: init
|
2023-04-24 16:35:46 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-12-13 05:55:39 +00:00
|
|
|
strategy:
|
2023-09-25 12:34:41 +00:00
|
|
|
max-parallel: 1 # run sequential to prevent download/upload collisions
|
2022-12-13 05:55:39 +00:00
|
|
|
matrix:
|
|
|
|
pkg-name: ${{ fromJSON(inputs.pkg-names) }}
|
|
|
|
steps:
|
2023-09-25 12:34:41 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ inputs.artifact-name }}
|
|
|
|
path: pypi
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: 3.9
|
2022-12-13 05:55:39 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- run: python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg-name }}' == 'pytorch' else 1))" >> $GITHUB_ENV
|
|
|
|
- name: Build & check package
|
|
|
|
uses: ./.github/actions/pkg-check
|
|
|
|
with:
|
|
|
|
pkg-name: ${{ matrix.pkg-name }}
|
|
|
|
nb-dirs: ${{ env.NB_DIRS }}
|
2022-12-13 05:55:39 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- run: |
|
|
|
|
mkdir pypi/${{ matrix.pkg-name }}
|
|
|
|
cp dist/* pypi/${{ matrix.pkg-name }}/
|
2022-12-13 05:55:39 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ inputs.artifact-name }}
|
|
|
|
path: pypi
|