Skip to content

Commit 6b28986

Browse files
author
andy-neuma
committed
Merge remote-tracking branch 'origin/main' into standardization
2 parents 55fc458 + 6127823 commit 6b28986

File tree

9 files changed

+249
-13
lines changed

9 files changed

+249
-13
lines changed

actions/build-ml-whl/action.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Build Wheel"
2+
description: "Build wheel for ML repos e.g. sparseml, compressed-tensors"
3+
4+
inputs:
5+
dev:
6+
description: 'If the build is a dev build'
7+
required: false
8+
default: false
9+
release:
10+
description: 'If the build is a release build'
11+
required: false
12+
default: false
13+
name:
14+
description: 'Name to append to the wheel'
15+
required: false
16+
venv:
17+
description: 'path of virtualenv if using it'
18+
required: false
19+
outputs:
20+
whlname:
21+
description: 'wheel filename'
22+
value: ${{ steps.build.outputs.whlname }}
23+
tarname:
24+
description: 'tar.gz filename'
25+
value: ${{ steps.build.outputs.tarname }}
26+
status:
27+
description: 'status of wheel build'
28+
value: ${{ steps.build.outputs.status }}
29+
30+
# can we just pass in build args instead of updating the variables in version.py?
31+
runs:
32+
using: "composite"
33+
steps:
34+
- name: build
35+
id: build
36+
shell: bash
37+
run: |
38+
if [[ ! -z "${{ inputs.venv }}" ]]; then
39+
source ${{ inputs.venv }}/bin/activate
40+
fi
41+
pip install wheel
42+
name="${{ inputs.name }}"
43+
ver_file=$(find . -type f -name "version.py")
44+
if ${{ inputs.release }}; then
45+
sed -i 's/is_release = False/is_release = True/g' ${ver_file}
46+
sed -i 's/build_type = "dev"/build_type = "release"/g' ${ver_file}
47+
elif ${{ inputs.dev }}; then
48+
sed -i 's/is_dev = False/is_dev = True/g' ${ver_file}
49+
sed -i 's/dev_number = None/dev_number = '"$name"'/g' ${ver_file}
50+
else
51+
sed -i 's/build_type = "dev"/build_type = "nightly"/g' ${ver_file}
52+
fi
53+
status=0
54+
makefile_path=$(find . -type f -name "Makefile")
55+
cd $(dirname ${makefile_path})
56+
make -B build || status=$?
57+
ls dist/; mkdir build-results
58+
echo "
59+
<testsuites>
60+
<testsuite errors=\"$status\" failures=\"$status\" name=\"build\" skipped=\"0\" tests=\"1\">
61+
<testcase classname=\"build\"/>
62+
</testsuite>
63+
</testsuites>" > build-results/result.xml
64+
echo "=========== Build log ==========="
65+
echo "$status"
66+
echo "whlname=$(find dist -name '*.whl' -exec basename {} \;)" >> "$GITHUB_OUTPUT"
67+
echo "tarname=$(find dist -name '*.tar.gz' -exec basename {} \;)" >> "$GITHUB_OUTPUT"
68+
echo "status=${status}" >> "$GITHUB_OUTPUT"
69+
exit ${status}

actions/create-virtualenv/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: create virtualenv
2+
description: 'create virtualenv using input name'
3+
inputs:
4+
venv:
5+
description: 'name of virtualenv'
6+
required: true
7+
outputs:
8+
penv:
9+
description: 'path of the created virtualenv'
10+
value: ${{ steps.env.outputs.penv }}
11+
runs:
12+
using: composite
13+
steps:
14+
- id: env
15+
run: |
16+
# install virtualenv
17+
python -m pip install virtualenv
18+
python -m virtualenv ${{ inputs.venv }}
19+
pwd; ls -al
20+
echo "penv=$(pwd)/${{ inputs.venv }}" >> "$GITHUB_OUTPUT"
21+
shell: bash
22+

actions/install-whl/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: install whl
2+
description: 'installs found whl based on python version into specified venv'
3+
inputs:
4+
venv:
5+
description: "path of virtualenv"
6+
required: true
7+
name:
8+
description: "name contained in the whl name, e.g. llmcompressor, compressed_tensors etc"
9+
required: true
10+
extra:
11+
description: "extra dependency of the whl to install"
12+
required: false
13+
runs:
14+
using: composite
15+
steps:
16+
- id: install_whl
17+
run: |
18+
source ${{ inputs.venv }}/bin/activate
19+
python --version
20+
WHL=$(find . -type f -iname "${{ inputs.name }}*.whl")
21+
if [ ! -z "${{ inputs.extra }}" ]; then
22+
pip install ${WHL}${{ inputs.extra }}
23+
else
24+
pip install ${WHL}
25+
fi
26+
version=$(pip freeze | grep "${{ inputs.name }}")
27+
echo "installed ${version}"
28+
shell: bash

actions/set-python/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
---
2-
name: Set Python
3-
description: Sets the Python version and creates a virtual environment
1+
name: Set Python With Pyenv
2+
description: Sets the Python version with pyenv and creates a virtual environment
43

54
inputs:
65
python:

actions/summary-build/action.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: build summary
2+
description: 'creates a GHA run summary'
3+
inputs:
4+
label:
5+
description: 'GHA runner label'
6+
required: true
7+
gitref:
8+
description: 'git commit hash or branch name'
9+
required: true
10+
whl_status:
11+
description: 'status from build step'
12+
required: true
13+
runs:
14+
using: composite
15+
steps:
16+
- run: |
17+
if [ ${{ inputs.whl_status }} -eq 0 ]; then
18+
# green check
19+
WHL_EMOJI=$(echo -e "\xE2\x9C\x85")
20+
else
21+
# red x
22+
WHL_EMOJI=$(echo -e "\xE2\x9D\x8C")
23+
fi
24+
echo ""
25+
echo "| Parameter | |" >> $GITHUB_STEP_SUMMARY
26+
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
27+
echo "| label: | \`${{ inputs.label }}\` |" >> $GITHUB_STEP_SUMMARY
28+
echo "| git sha: | \`${{ github.sha }}\` |" >> $GITHUB_STEP_SUMMARY
29+
echo "| github actor: | '${{ github.actor }}' |" >> $GITHUB_STEP_SUMMARY
30+
echo "| gitref: | '${{ inputs.gitref }}' |" >> $GITHUB_STEP_SUMMARY
31+
echo "| whl: | ${WHL_EMOJI} |" >> $GITHUB_STEP_SUMMARY
32+
shell: bash

actions/summary-test/action.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: test summary
2+
description: 'creates a neuralmagic GHA run summary'
3+
inputs:
4+
test_label:
5+
description: 'GHA runner label'
6+
required: true
7+
gitref:
8+
description: 'git commit hash or branch name'
9+
required: true
10+
testmo_run_url:
11+
description: 'testmo URL for this particular run'
12+
required: true
13+
python:
14+
description: 'python version info'
15+
required: true
16+
whl:
17+
description: 'whl file tested'
18+
required: true
19+
test_status:
20+
description: 'status from test step'
21+
required: true
22+
runs:
23+
using: composite
24+
steps:
25+
- run: |
26+
if [ ${{ inputs.test_status }} -eq 0 ]; then
27+
# green check
28+
TEST_EMOJI=$(echo -e "\xE2\x9C\x85")
29+
else
30+
# red x
31+
TEST_EMOJI=$(echo -e "\xE2\x9D\x8C")
32+
fi
33+
echo "| Parameter | |" >> $GITHUB_STEP_SUMMARY
34+
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
35+
echo "| label: | \`${{ inputs.test_label }}\` |" >> $GITHUB_STEP_SUMMARY
36+
echo "| git sha: | \`${{ github.sha }}\` |" >> $GITHUB_STEP_SUMMARY
37+
echo "| github actor: | '${{ github.actor }}' |" >> $GITHUB_STEP_SUMMARY
38+
echo "| gitref: | '${{ inputs.gitref }}' |" >> $GITHUB_STEP_SUMMARY
39+
echo "| branch name: | '${{ github.ref_name }}' |" >> $GITHUB_STEP_SUMMARY
40+
echo "| python: | ${{ inputs.python }} |" >> $GITHUB_STEP_SUMMARY
41+
echo "| whl: | ${{ inputs.whl }} |" >> $GITHUB_STEP_SUMMARY
42+
echo "| test: | ${TEST_EMOJI} |" >> $GITHUB_STEP_SUMMARY
43+
echo "" >> $GITHUB_STEP_SUMMARY
44+
echo "#### TestMo URL: ${{ inputs.testmo_run_url }}" >> $GITHUB_STEP_SUMMARY
45+
shell: bash

actions/testmo-run-create/action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ runs:
4545
exit 1
4646
fi
4747
## construct name
48-
BRANCH_NAME=${GITHUB_REF_NAME}
49-
TMP=${ACTOR}-${BRANCH_NAME}
50-
TESTMO_RUN_NAME=$(echo ${TMP} | awk '{print tolower($0)}')
48+
TESTMO_RUN_NAME="${{ inputs.run_name }}"
49+
if [[ -z "${{ inputs.run_name }}" ]]; then
50+
BRANCH_NAME=${GITHUB_REF_NAME}
51+
TMP=${ACTOR}-${BRANCH_NAME}
52+
TESTMO_RUN_NAME=$(echo ${TMP} | awk '{print tolower($0)}')
53+
fi
5154
echo "test run name: ${TESTMO_RUN_NAME}"
5255
## create testmo run
5356
TESTMO_ID=$(npx testmo automation:run:create \
@@ -60,4 +63,5 @@ runs:
6063
env:
6164
TESTMO_URL: ${{ inputs.testmo_url }}
6265
TESTMO_TOKEN: ${{ inputs.testmo_token }}
66+
PROJECT_ID: ${{ inputs.project_id }}
6367
shell: bash

actions/testmo-run-submit-thread/action.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ runs:
2929
steps:
3030
- id: submit_thread
3131
run: |
32-
ls -al
33-
## if results is non-existent or there aren't results, then nothing to submit ...
32+
# verify there are result files to be submitted
33+
ls -Al
3434
REPORT=1
3535
RESULTS=
3636
if [[ ! -d ${{ inputs.results }} ]]; then
@@ -41,18 +41,31 @@ runs:
4141
if [[ -z "${RESULTS}" ]]; then
4242
REPORT=0
4343
fi
44-
## submit results?
44+
45+
step_status() {
46+
# echo "green encased checkmark" if "${1} == 0"
47+
# echo "red X" if "${1} != 0"
48+
49+
if [ "$1" -eq 0 ]; then
50+
# green check
51+
echo -e "\xE2\x9C\x85"
52+
else
53+
# red x
54+
echo -e "\xE2\x9D\x8C"
55+
fi
56+
}
57+
58+
# submit results
4559
SUCCESS=0
4660
if [ ${REPORT} -eq 1 ]; then
4761
echo "submitting results to TESTMO run ..."
48-
## not checking testmo_url and token as this should be
49-
## called between "create" and "complete"
62+
# not checking testmo_url and token as this should be
63+
# called between "create" and "complete"
5064
npx testmo automation:run:submit-thread \
5165
--instance ${TESTMO_URL} \
5266
--run-id ${TESTMO_RUN_ID} \
5367
--results ${RESULTS} \
54-
-- ./.github/scripts/step-status ${{ inputs.step_status }}
55-
SUCCESS=$?
68+
-- step-status "${{ inputs.step_status }}" || SUCCESS=$?
5669
fi
5770
echo "status=${SUCCESS}" >> "$GITHUB_OUTPUT"
5871
exit ${SUCCESS}

actions/verify-python/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: verify python
2+
description: 'verify env python version if matching the expected version'
3+
inputs:
4+
python-version:
5+
description: "version of python to verify, e.g. 3.10"
6+
required: true
7+
outputs:
8+
version:
9+
description: "result from 'python --version'"
10+
value: ${{ steps.env_python.outputs.version }}
11+
runs:
12+
using: composite
13+
steps:
14+
- id: env_python
15+
run: |
16+
VERSION=$(python --version | cut -d' ' -f2)
17+
if [[ "${VERSION}" =~ ^${{ inputs.python-version }} ]]; then
18+
echo "verified python-version=${VERSION}, matching expected ${{ inputs.python-version }}"
19+
exit 0
20+
else
21+
echo "FAILED: python-version=${VERSION}, not matching expected ${{ inputs.python-version }}"
22+
exit 1
23+
fi
24+
shell: bash

0 commit comments

Comments
 (0)