Skip to content

Commit a0313ba

Browse files
psychedelicioushipsterusername
authored andcommitted
feat: automated releases via github action
- Restructure & update code check workflows - Add release workflow to handle checks/tests, build and publish to PyPI - Add docs/RELEASE.md explaining the workflow & process - `create_installer.sh`: Update to work with the release workflow - `create_installer.sh` & `tag_release.sh`: Fix the ANSI escape codes for macOS - `tag_release.sh`: Add check for python binary name - `tag_release.sh`: Print `git remote -v` output - `tag_release.sh`: Fix error when deleting nonexistant tags
1 parent 3a2afe1 commit a0313ba

17 files changed

+565
-125
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Install frontend dependencies
2+
description: Installs frontend dependencies with pnpm, with caching
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Setup Node 18
7+
uses: actions/setup-node@v4
8+
with:
9+
node-version: '18'
10+
11+
- name: Setup pnpm
12+
uses: pnpm/action-setup@v2
13+
with:
14+
version: 8
15+
run_install: false
16+
17+
- name: Get pnpm store directory
18+
shell: bash
19+
run: |
20+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
21+
22+
- uses: actions/cache@v3
23+
name: Setup pnpm cache
24+
with:
25+
path: ${{ env.STORE_PATH }}
26+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
27+
restore-keys: |
28+
${{ runner.os }}-pnpm-store-
29+
30+
- name: Install frontend dependencies
31+
run: pnpm install --prefer-frozen-lockfile
32+
shell: bash
33+
working-directory: invokeai/frontend/web
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Install python dependencies
2+
description: Install python dependencies with pip, with caching
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Setup python
7+
uses: actions/setup-python@v5
8+
with:
9+
python-version: '3.10'
10+
cache: pip
11+
cache-dependency-path: pyproject.toml

.github/workflows/build-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- 'docker/docker-entrypoint.sh'
1212
- 'workflows/build-container.yml'
1313
tags:
14-
- 'v*'
14+
- 'v*.*.*'
1515
workflow_dispatch:
1616

1717
permissions:

.github/workflows/check-frontend.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Check: frontend'
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
defaults:
8+
run:
9+
working-directory: invokeai/frontend/web
10+
11+
jobs:
12+
check-frontend:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up frontend
18+
uses: ./.github/actions/install-frontend-deps
19+
20+
- name: Run tsc check
21+
run: 'pnpm run lint:tsc'
22+
shell: bash
23+
24+
- name: Run dpdm check
25+
run: 'pnpm run lint:dpdm'
26+
shell: bash
27+
28+
- name: Run eslint check
29+
run: 'pnpm run lint:eslint'
30+
shell: bash
31+
32+
- name: Run prettier check
33+
run: 'pnpm run lint:prettier'
34+
shell: bash
35+
36+
- name: Run knip check
37+
run: 'pnpm run lint:knip'
38+
shell: bash

.github/workflows/test-invoke-pip.yml renamed to .github/workflows/check-pytest.yml

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
1-
name: Test invoke.py pip
1+
name: 'Check: pytest'
2+
23
on:
3-
push:
4-
branches:
5-
- 'main'
6-
pull_request:
7-
types:
8-
- 'ready_for_review'
9-
- 'opened'
10-
- 'synchronize'
11-
merge_group:
124
workflow_dispatch:
5+
workflow_call:
136

147
concurrency:
158
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
169
cancel-in-progress: true
1710

1811
jobs:
1912
matrix:
20-
if: github.event.pull_request.draft == false
2113
strategy:
2214
matrix:
2315
python-version:
24-
# - '3.9'
2516
- '3.10'
2617
pytorch:
2718
- linux-cuda-11_7
@@ -52,43 +43,26 @@ jobs:
5243
env:
5344
PIP_USE_PEP517: '1'
5445
steps:
55-
- name: Checkout sources
56-
id: checkout-sources
57-
uses: actions/checkout@v3
58-
59-
- name: Check for changed python files
60-
id: changed-files
61-
uses: tj-actions/changed-files@v41
62-
with:
63-
files_yaml: |
64-
python:
65-
- 'pyproject.toml'
66-
- 'invokeai/**'
67-
- '!invokeai/frontend/web/**'
68-
- 'tests/**'
46+
- uses: actions/checkout@v4
6947

7048
- name: set test prompt to main branch validation
71-
if: steps.changed-files.outputs.python_any_changed == 'true'
7249
run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.github-env }}
7350

7451
- name: setup python
75-
if: steps.changed-files.outputs.python_any_changed == 'true'
7652
uses: actions/setup-python@v4
7753
with:
7854
python-version: ${{ matrix.python-version }}
7955
cache: pip
8056
cache-dependency-path: pyproject.toml
8157

8258
- name: install invokeai
83-
if: steps.changed-files.outputs.python_any_changed == 'true'
8459
env:
8560
PIP_EXTRA_INDEX_URL: ${{ matrix.extra-index-url }}
8661
run: >
8762
pip3 install
8863
--editable=".[test]"
8964
9065
- name: run pytest
91-
if: steps.changed-files.outputs.python_any_changed == 'true'
9266
id: run-pytest
9367
run: pytest
9468

.github/workflows/check-python.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Check: python'
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
check-backend:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install python dependencies
14+
uses: ./.github/actions/install-python-deps
15+
16+
- name: Install ruff
17+
run: pip install ruff
18+
shell: bash
19+
20+
- name: Ruff check
21+
run: ruff check --output-format=github .
22+
shell: bash
23+
24+
- name: Ruff format
25+
run: ruff format --check .
26+
shell: bash

.github/workflows/lint-frontend.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 'On change: run check-frontend'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
types:
9+
- 'ready_for_review'
10+
- 'opened'
11+
- 'synchronize'
12+
merge_group:
13+
14+
jobs:
15+
check-changed-frontend-files:
16+
if: github.event.pull_request.draft == false
17+
runs-on: ubuntu-latest
18+
outputs:
19+
frontend_any_changed: ${{ steps.changed-files.outputs.frontend_any_changed }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Check for changed frontend files
24+
id: changed-files
25+
uses: tj-actions/changed-files@v40
26+
with:
27+
files_yaml: |
28+
frontend:
29+
- 'invokeai/frontend/web/**'
30+
31+
run-check-frontend:
32+
needs: check-changed-frontend-files
33+
if: ${{ needs.check-changed-frontend-files.outputs.frontend_any_changed == 'true' }}
34+
uses: ./.github/workflows/check-frontend.yml
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'On change: run check-python'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
types:
9+
- 'ready_for_review'
10+
- 'opened'
11+
- 'synchronize'
12+
merge_group:
13+
14+
jobs:
15+
check-changed-python-files:
16+
if: github.event.pull_request.draft == false
17+
runs-on: ubuntu-latest
18+
outputs:
19+
python_any_changed: ${{ steps.changed-files.outputs.python_any_changed }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Check for changed python files
24+
id: changed-files
25+
uses: tj-actions/changed-files@v40
26+
with:
27+
files_yaml: |
28+
python:
29+
- 'pyproject.toml'
30+
- 'invokeai/**'
31+
- '!invokeai/frontend/web/**'
32+
- 'tests/**'
33+
34+
run-check-python:
35+
needs: check-changed-python-files
36+
if: ${{ needs.check-changed-python-files.outputs.python_any_changed == 'true' }}
37+
uses: ./.github/workflows/check-python.yml
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'On change: run pytest'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
types:
9+
- 'ready_for_review'
10+
- 'opened'
11+
- 'synchronize'
12+
merge_group:
13+
14+
jobs:
15+
check-changed-python-files:
16+
if: github.event.pull_request.draft == false
17+
runs-on: ubuntu-latest
18+
outputs:
19+
python_any_changed: ${{ steps.changed-files.outputs.python_any_changed }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Check for changed python files
24+
id: changed-files
25+
uses: tj-actions/changed-files@v40
26+
with:
27+
files_yaml: |
28+
python:
29+
- 'pyproject.toml'
30+
- 'invokeai/**'
31+
- '!invokeai/frontend/web/**'
32+
- 'tests/**'
33+
34+
run-pytest:
35+
needs: check-changed-python-files
36+
if: ${{ needs.check-changed-python-files.outputs.python_any_changed == 'true' }}
37+
uses: ./.github/workflows/check-pytest.yml

0 commit comments

Comments
 (0)