ci: 🚀 add gh action (#4)
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
name: 📦 Building wheels
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# tags:
|
||||
# - "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
platform: win32
|
||||
arch: x64
|
||||
# - os: macos-latest
|
||||
# platform: darwin
|
||||
# arch: arm64
|
||||
- os: ubuntu-latest
|
||||
platform: linux
|
||||
arch: x64
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
archive_name: deps-wheels_${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.arch }}
|
||||
steps:
|
||||
- name: ♻️ Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
- name: "🐍 Setting up Python"
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10.9"
|
||||
|
||||
- name: 📦 Building and Bundling wheels
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip wheel --no-cache-dir -r requirements-wheels.txt -w ./wheels > build.log
|
||||
|
||||
cat build.log
|
||||
|
||||
# find source wheels
|
||||
packages=$(cat build.log | awk -F 'Building wheels for collected packages: ' '{print $2}')
|
||||
packages=$(echo "$packages" | tr -d '[:space:]')
|
||||
|
||||
IFS=', ' read -r -a package_array <<< "$packages"
|
||||
|
||||
printf "Autodetect this source package: \e[32m%s\e[0m\n" "${package_array[@]}"
|
||||
|
||||
# Iterate through the wheel files and remove those that are not source built
|
||||
for wheel_file in ./wheels/*.whl; do
|
||||
# Extract the package name from the wheel filename
|
||||
package_name=$(basename "$wheel_file" .whl | awk -F '-' '{print $1}')
|
||||
|
||||
printf "Checking package: %s\n" "$package_name"
|
||||
|
||||
# Check if the package is not in the array of source built packages
|
||||
if [[ ! " ${package_array[@]} " =~ " ${package_name} " ]]; then
|
||||
echo "Removing $wheel_file"
|
||||
rm "$wheel_file"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||
"C:/Program Files/7-Zip/7z.exe" a -mfb=258 -tzip ${{ env.archive_name }}.zip wheels
|
||||
else
|
||||
zip -r -9 -y -m ${{ env.archive_name }}.zip wheels
|
||||
fi
|
||||
- name: 💾 Store cache
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: ${{ env.archive_name }}.zip
|
||||
key: ${{ env.archive_name }}
|
||||
@@ -0,0 +1,79 @@
|
||||
name: 📦 Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
name:
|
||||
description: Release tag / name ?
|
||||
required: true
|
||||
default: "latest"
|
||||
type: string
|
||||
environment:
|
||||
description: Environment to run tests against
|
||||
type: environment
|
||||
required: false
|
||||
# push:
|
||||
# tags:
|
||||
# - "v*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
repo_name: ${{ github.event.repository.name }}
|
||||
steps:
|
||||
- name: ♻️ Checking out the repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
path: ${{ env.repo_name }}
|
||||
- name: 📦 Building custom comfy nodes
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$RUNNER_OS" == "Windows" ]; then
|
||||
"C:/Program Files/7-Zip/7z.exe" a -mfb=258 -tzip ${{ env.repo_name }}-${{ inputs.name }}.zip ${{ env.repo_name }}
|
||||
else
|
||||
zip -r -9 -y -m ${{ env.repo_name }}-${{ inputs.name }}.zip ${{ env.repo_name }}
|
||||
fi
|
||||
|
||||
- name: ✅ Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ inputs.name }}
|
||||
files: |
|
||||
${{ env.repo_name }}-${{ inputs.name }}.zip
|
||||
|
||||
release-wheels:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
platform: win32
|
||||
arch: x64
|
||||
# - os: macos-latest
|
||||
# platform: darwin
|
||||
# arch: arm64
|
||||
- os: ubuntu-latest
|
||||
platform: linux
|
||||
arch: x64
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
archive_name: deps-wheels_${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.arch }}
|
||||
steps:
|
||||
- name: 💾 Restore cache
|
||||
uses: actions/cache/restore@v3
|
||||
id: cache
|
||||
with:
|
||||
path: ${{ env.archive_name }}.zip
|
||||
key: ${{ env.archive_name }}
|
||||
- name: ✅ Add wheels to release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ inputs.name }}
|
||||
files: |
|
||||
${{ env.archive_name }}.zip
|
||||
Reference in New Issue
Block a user