Skip to content

Commit

Permalink
ci: πŸš€ add gh action (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
melMass committed Jun 28, 2023
1 parent bcf55ca commit 572b4d5
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/package_wheels.yml
Original file line number Diff line number Diff line change
@@ -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 }}
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 572b4d5

Please sign in to comment.