ci: split build job

This commit is contained in:
psychedelicious 2024-03-02 22:45:28 +11:00 committed by Kent Keirsey
parent 06fc6ccfe5
commit 3ba5c2b0b4
2 changed files with 70 additions and 72 deletions

43
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: build installer
on:
workflow_dispatch:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5 # expected run time: <2 min
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
cache-dependency-path: pyproject.toml
- name: install pypa/build
run: pip install --upgrade build
- name: setup frontend
uses: ./.github/actions/install-frontend-deps
- name: create installer
id: create_installer
run: ./create_installer.sh
working-directory: installer
- name: upload python distribution artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: ${{ steps.create_installer.outputs.DIST_PATH }}
- name: upload installer artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.create_installer.outputs.INSTALLER_FILENAME }}
path: ${{ steps.create_installer.outputs.INSTALLER_PATH }}

View File

@ -5,44 +5,9 @@ on:
tags: tags:
- 'v*' - 'v*'
workflow_dispatch: workflow_dispatch:
inputs:
skip_code_checks:
description: 'Skip code checks (disables publish)'
required: true
default: true
type: boolean
jobs: jobs:
frontend-checks:
if: github.event.inputs.skip_code_checks != 'true'
runs-on: ubuntu-latest
steps:
- name: run-frontend-checks
uses: ./.github/workflows/frontend-checks.yml
frontend-tests:
if: github.event.inputs.skip_code_checks != 'true'
runs-on: ubuntu-latest
steps:
- name: run-frontend-tests
uses: ./.github/workflows/frontend-tests.yml
python-checks:
if: github.event.inputs.skip_code_checks != 'true'
runs-on: ubuntu-latest
steps:
- name: run-python-checks
uses: ./.github/workflows/python-checks.yml
python-tests:
if: github.event.inputs.skip_code_checks != 'true'
runs-on: ubuntu-latest
steps:
- name: run-python-tests
uses: ./.github/workflows/python-tests.yml
check-version: check-version:
if: github.event.inputs.skip_code_checks != 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
@ -54,45 +19,36 @@ jobs:
with: with:
version_file_path: invokeai/version/invokeai_version.py version_file_path: invokeai/version/invokeai_version.py
frontend-checks:
needs: check-version
uses: ./.github/workflows/frontend-checks.yml
frontend-tests:
needs: check-version
uses: ./.github/workflows/frontend-tests.yml
python-checks:
needs: check-version
uses: ./.github/workflows/python-checks.yml
python-tests:
needs: check-version
uses: ./.github/workflows/python-tests.yml
build: build:
runs-on: ubuntu-latest needs:
timeout-minutes: 15 # expected run time: <10 min [
steps: check-version,
- name: checkout frontend-checks,
uses: actions/checkout@v4 frontend-tests,
python-checks,
- name: setup python python-tests,
uses: actions/setup-python@v5 ]
with: uses: ./.github/workflows/build.yml
python-version: '3.10'
cache: pip
cache-dependency-path: pyproject.toml
- name: install pypa/build
run: pip install --upgrade build
- name: setup frontend
uses: ./.github/actions/install-frontend-deps
- name: create installer
id: create_installer
run: ./create_installer.sh
working-directory: installer
- name: upload python distribution artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: ${{ steps.create_installer.outputs.DIST_PATH }}
- name: upload installer artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.create_installer.outputs.INSTALLER_FILENAME }}
path: ${{ steps.create_installer.outputs.INSTALLER_PATH }}
publish-testpypi: publish-testpypi:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 5 # expected run time: <1 min
needs: needs:
[ [
check-version, check-version,
@ -102,7 +58,6 @@ jobs:
python-tests, python-tests,
build, build,
] ]
if: github.event_name != 'workflow_dispatch'
environment: environment:
name: testpypi name: testpypi
url: https://test.pypi.org/p/invokeai url: https://test.pypi.org/p/invokeai
@ -120,6 +75,7 @@ jobs:
publish-pypi: publish-pypi:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 5 # expected run time: <1 min
needs: needs:
[ [
check-version, check-version,
@ -129,7 +85,6 @@ jobs:
python-tests, python-tests,
build, build,
] ]
if: github.event_name != 'workflow_dispatch'
environment: environment:
name: pypi name: pypi
url: https://pypi.org/p/invokeai url: https://pypi.org/p/invokeai