From 118d5b387b05c1e906cb186c1a7540379e13cc01 Mon Sep 17 00:00:00 2001 From: Brandon Rising Date: Tue, 1 Aug 2023 16:22:20 -0400 Subject: [PATCH] deploy: refactor github workflows Currently we use some workflow trigger conditionals to run either a real test workflow (installing the app and running it) or a fake workflow, disguised as the real one, that just auto-passes. This change refactors the workflow to use a single workflow that can be skipped, using another github action to determine which things to run depending on the paths changed. --- .github/workflows/style-checks.yml | 1 - .github/workflows/test-invoke-pip-skip.yml | 50 ---------------------- .github/workflows/test-invoke-pip.yml | 24 +++++++---- 3 files changed, 15 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/test-invoke-pip-skip.yml diff --git a/.github/workflows/style-checks.yml b/.github/workflows/style-checks.yml index 0bb19e95e5..d29b489418 100644 --- a/.github/workflows/style-checks.yml +++ b/.github/workflows/style-checks.yml @@ -6,7 +6,6 @@ on: pull_request: push: branches: main - tags: "*" jobs: black: diff --git a/.github/workflows/test-invoke-pip-skip.yml b/.github/workflows/test-invoke-pip-skip.yml deleted file mode 100644 index 004b46d5a8..0000000000 --- a/.github/workflows/test-invoke-pip-skip.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Test invoke.py pip - -# This is a dummy stand-in for the actual tests -# we don't need to run python tests on non-Python changes -# But PRs require passing tests to be mergeable - -on: - pull_request: - paths: - - '**' - - '!pyproject.toml' - - '!invokeai/**' - - '!tests/**' - - 'invokeai/frontend/web/**' - merge_group: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - matrix: - if: github.event.pull_request.draft == false - strategy: - matrix: - python-version: - - '3.10' - pytorch: - - linux-cuda-11_7 - - linux-rocm-5_2 - - linux-cpu - - macos-default - - windows-cpu - include: - - pytorch: linux-cuda-11_7 - os: ubuntu-22.04 - - pytorch: linux-rocm-5_2 - os: ubuntu-22.04 - - pytorch: linux-cpu - os: ubuntu-22.04 - - pytorch: macos-default - os: macOS-12 - - pytorch: windows-cpu - os: windows-2022 - name: ${{ matrix.pytorch }} on ${{ matrix.python-version }} - runs-on: ${{ matrix.os }} - steps: - - name: skip - run: echo "no build required" diff --git a/.github/workflows/test-invoke-pip.yml b/.github/workflows/test-invoke-pip.yml index 40be0a529e..6086d10069 100644 --- a/.github/workflows/test-invoke-pip.yml +++ b/.github/workflows/test-invoke-pip.yml @@ -3,16 +3,7 @@ on: push: branches: - 'main' - paths: - - 'pyproject.toml' - - 'invokeai/**' - - '!invokeai/frontend/web/**' pull_request: - paths: - - 'pyproject.toml' - - 'invokeai/**' - - 'tests/**' - - '!invokeai/frontend/web/**' types: - 'ready_for_review' - 'opened' @@ -65,10 +56,23 @@ jobs: id: checkout-sources uses: actions/checkout@v3 + - name: Check for changed python files + id: changed-files + uses: tj-actions/changed-files@v37 + with: + files_yaml: | + python: + - 'pyproject.toml' + - 'invokeai/**' + - '!invokeai/frontend/web/**' + - 'tests/**' + - name: set test prompt to main branch validation + if: steps.changed-files.outputs.python_any_changed == 'true' run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.github-env }} - name: setup python + if: steps.changed-files.outputs.python_any_changed == 'true' uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -76,6 +80,7 @@ jobs: cache-dependency-path: pyproject.toml - name: install invokeai + if: steps.changed-files.outputs.python_any_changed == 'true' env: PIP_EXTRA_INDEX_URL: ${{ matrix.extra-index-url }} run: > @@ -83,6 +88,7 @@ jobs: --editable=".[test]" - name: run pytest + if: steps.changed-files.outputs.python_any_changed == 'true' id: run-pytest run: pytest