Merge pull request #356 from XpressAI/fahreza/run-type-update #965
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: Python Package Builder | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ "*" ] | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to run the tests on' | |
required: false | |
default: 'master' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Determine Branch Name | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
branch_name="${{ github.head_ref }}" | |
else | |
branch_name="${{ github.ref_name }}" | |
fi | |
echo "branch_name=$branch_name" >> $GITHUB_ENV | |
- name: Sanitize Branch Name and Git Hash | |
run: | | |
sanitized_branch_name=$(echo "$branch_name" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens | |
sanitized_git_hash=$(git rev-parse --short "$GITHUB_SHA" | sed 's/[^a-zA-Z0-9_-]/_/g') # Preserving hyphens | |
echo "sanitized_branch_name=$sanitized_branch_name" >> $GITHUB_ENV | |
echo "sanitized_git_hash=$sanitized_git_hash" >> $GITHUB_ENV | |
- name: Check Branch and Hash | |
run: | | |
echo "Branch: $sanitized_branch_name" | |
echo "Hash: $sanitized_git_hash" | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install Yarn | |
run: npm install --global yarn | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Build Extension in Dev Mode | |
run: pip install -e . | |
- name: Build Wheel | |
run: | | |
python -m pip install --upgrade build | |
python -m build | |
- name: Upload Dist Directory Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xircuits-wheel-${{ env.sanitized_branch_name }}-${{ matrix.python-version }}-${{ env.sanitized_git_hash }} | |
path: dist |