Add metadata field for ChatModel (#13143) #162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test package build | |
on: | |
push: | |
branches: | |
- master | |
- branch-[0-9]+.[0-9]+ | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash --noprofile --norc -exo pipefail {0} | |
jobs: | |
build: | |
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
permissions: | |
actions: write # deleteArtifact | |
strategy: | |
matrix: | |
type: ["full", "skinny"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: ./.github/actions/untracked | |
- uses: ./.github/actions/setup-python | |
- uses: ./.github/actions/setup-node | |
- name: Build UI | |
working-directory: mlflow/server/js | |
run: | | |
yarn | |
yarn build | |
- name: Install dependencies | |
run: | | |
pip install build twine | |
- name: Build distribution files | |
id: build-dist | |
run: | | |
if [ "${{ matrix.type }}" == "skinny" ]; then | |
python dev/build.py --package-type skinny | |
else | |
python dev/build.py | |
fi | |
# List distribution files and check their file sizes | |
ls -lh dist | |
# Set step outputs | |
sdist_path=$(find dist -type f -name "*.tar.gz") | |
wheel_path=$(find dist -type f -name "*.whl") | |
wheel_name=$(basename $wheel_path) | |
wheel_size=$(stat -c %s $wheel_path) | |
echo "sdist-path=${sdist_path}" >> $GITHUB_OUTPUT | |
echo "wheel-path=${wheel_path}" >> $GITHUB_OUTPUT | |
echo "wheel-name=${wheel_name}" >> $GITHUB_OUTPUT | |
echo "wheel-size=${wheel_size}" >> $GITHUB_OUTPUT | |
- name: List files in source distribution | |
run: | | |
tar -tf ${{ steps.build-dist.outputs.sdist-path }} | |
- name: List files in binary distribution | |
run: | | |
unzip -l ${{ steps.build-dist.outputs.wheel-path }} | |
- name: Compare files in source and binary distributions | |
run: | | |
tar -tzf ${{ steps.build-dist.outputs.sdist-path }} | grep -v '/$' | cut -d'/' -f2- | sort > /tmp/source.txt | |
zipinfo -1 ${{ steps.build-dist.outputs.wheel-path }} | sort > /tmp/wheel.txt | |
diff /tmp/source.txt /tmp/wheel.txt || true | |
- name: Run twine check | |
run: | | |
twine check --strict ${{ steps.build-dist.outputs.wheel-path }} | |
- name: Test installation from tarball | |
run: | | |
pip install ${{ steps.build-dist.outputs.sdist-path }} | |
python -c "import mlflow; print(mlflow.__version__)" | |
- name: Test installation from wheel | |
run: | | |
pip install --force-reinstall ${{ steps.build-dist.outputs.wheel-path }} | |
python -c "import mlflow; print(mlflow.__version__)" | |
# Anyone with read access can download the uploaded wheel on GitHub. | |
- name: Store wheel | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'push' | |
with: | |
name: ${{ steps.build-dist.outputs.wheel-name }} | |
path: ${{ steps.build-dist.outputs.wheel-path }} | |
- name: Remove old wheels | |
uses: actions/github-script@v7 | |
if: github.event_name == 'push' | |
env: | |
WHEEL_SIZE: ${{ steps.build-dist.outputs.wheel-size }} | |
with: | |
script: | | |
const { owner, repo } = context.repo; | |
// For some reason, the newly-uploaded wheel in the previous step is not included. | |
const artifactsResp = await github.rest.actions.listArtifactsForRepo({ | |
owner, | |
repo, | |
}); | |
const wheels = artifactsResp.data.artifacts.filter(({ name }) => name.endsWith(".whl")); | |
// The storage usage limit for a free github account is up to 500 MB. See the page below for details: | |
// https://docs.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/about-billing-for-github-actions | |
MAX_SIZE_IN_BYTES = 300_000_000; // 300 MB | |
let index = 0; | |
let sum = parseInt(process.env.WHEEL_SIZE); // include the newly-uploaded wheel | |
for (const [idx, { size_in_bytes }] of wheels.entries()) { | |
index = idx; | |
sum += size_in_bytes; | |
if (sum > MAX_SIZE_IN_BYTES) { | |
break; | |
} | |
} | |
if (sum <= MAX_SIZE_IN_BYTES) { | |
return; | |
} | |
// Delete old wheels | |
const promises = wheels.slice(index).map(({ id: artifact_id }) => | |
github.rest.actions.deleteArtifact({ | |
owner, | |
repo, | |
artifact_id, | |
}) | |
); | |
Promise.all(promises).then(data => console.log(data)); |