From f6b2a62beab5af0d26ecba527339c40f7a9c8177 Mon Sep 17 00:00:00 2001 From: Eugene Brodsky Date: Sun, 11 Dec 2022 14:49:28 -0500 Subject: [PATCH 1/8] (ci) do not run docker image build workflow on PRs --- .github/workflows/build-cloud-img.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-cloud-img.yml b/.github/workflows/build-cloud-img.yml index 9ef41a26c3..7bfe309358 100644 --- a/.github/workflows/build-cloud-img.yml +++ b/.github/workflows/build-cloud-img.yml @@ -6,10 +6,8 @@ on: - main tags: - v* - # we will NOT push the image on pull requests, only test buildability. - pull_request: - branches: - - main + + permissions: contents: read @@ -66,9 +64,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - # do not login to container registry on PRs - - if: github.event_name != 'pull_request' - name: Docker login + - name: Docker login uses: docker/login-action@v2 with: registry: ghcr.io @@ -82,6 +78,7 @@ jobs: file: docker-build/Dockerfile.cloud platforms: Linux/${{ matrix.arch }} # do not push the image on PRs + # yes, we do not run this on PRs, but this is an additional safety net push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 8d22f6de1e498c31ec159aa2ad8f90449213b112 Mon Sep 17 00:00:00 2001 From: Eugene Brodsky Date: Sun, 11 Dec 2022 14:50:20 -0500 Subject: [PATCH 2/8] (ci) run cloud docker image build on all tags --- .github/workflows/build-cloud-img.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cloud-img.yml b/.github/workflows/build-cloud-img.yml index 7bfe309358..a96c7a746c 100644 --- a/.github/workflows/build-cloud-img.yml +++ b/.github/workflows/build-cloud-img.yml @@ -5,7 +5,7 @@ on: branches: - main tags: - - v* + - "*" From 9df2ae76298ee072978467ddcc9dc653ff5a1dd8 Mon Sep 17 00:00:00 2001 From: Eugene Brodsky Date: Sun, 11 Dec 2022 14:51:38 -0500 Subject: [PATCH 3/8] (ci) cancel redundant in-progress workflows for cloud docker build --- .github/workflows/build-cloud-img.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-cloud-img.yml b/.github/workflows/build-cloud-img.yml index a96c7a746c..2297a06bae 100644 --- a/.github/workflows/build-cloud-img.yml +++ b/.github/workflows/build-cloud-img.yml @@ -7,7 +7,9 @@ on: tags: - "*" - +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true permissions: contents: read From c3a1c8c48105299f92770edeef1c9bc8ff39b7ab Mon Sep 17 00:00:00 2001 From: Eugene Brodsky Date: Sun, 11 Dec 2022 14:52:44 -0500 Subject: [PATCH 4/8] (ci) generally cancel redundant workflows to free up runners and speed up CI --- .github/workflows/build-container.yml | 4 ++++ .github/workflows/test-invoke-conda.yml | 4 ++++ .github/workflows/test-invoke-pip.yml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 3b102d3397..7b677195e1 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -6,6 +6,10 @@ on: branches: - 'main' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: docker: strategy: diff --git a/.github/workflows/test-invoke-conda.yml b/.github/workflows/test-invoke-conda.yml index b96f50f123..cdbf3fea4b 100644 --- a/.github/workflows/test-invoke-conda.yml +++ b/.github/workflows/test-invoke-conda.yml @@ -9,6 +9,10 @@ on: - 'main' - 'development' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: matrix: strategy: diff --git a/.github/workflows/test-invoke-pip.yml b/.github/workflows/test-invoke-pip.yml index adc03ed0f1..dabb9fb942 100644 --- a/.github/workflows/test-invoke-pip.yml +++ b/.github/workflows/test-invoke-pip.yml @@ -9,6 +9,10 @@ on: - 'main' - 'development' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: matrix: strategy: From 9041af117b450626bbc34b52baf30300866559af Mon Sep 17 00:00:00 2001 From: Eugene Brodsky Date: Sun, 11 Dec 2022 16:06:49 -0500 Subject: [PATCH 5/8] (ci) remove conda test workflow --- .github/workflows/test-invoke-conda.yml | 150 ------------------------ 1 file changed, 150 deletions(-) delete mode 100644 .github/workflows/test-invoke-conda.yml diff --git a/.github/workflows/test-invoke-conda.yml b/.github/workflows/test-invoke-conda.yml deleted file mode 100644 index cdbf3fea4b..0000000000 --- a/.github/workflows/test-invoke-conda.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: Test invoke.py -on: - push: - branches: - - 'main' - - 'development' - pull_request: - branches: - - 'main' - - 'development' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - matrix: - strategy: - matrix: - stable-diffusion-model: - - 'stable-diffusion-1.5' - environment-yaml: - - environment-lin-amd.yml - - environment-lin-cuda.yml - - environment-mac.yml - - environment-win-cuda.yml - include: - - environment-yaml: environment-lin-amd.yml - os: ubuntu-22.04 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-lin-cuda.yml - os: ubuntu-22.04 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-mac.yml - os: macos-12 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-win-cuda.yml - os: windows-2022 - curl-command: curl.exe - github-env: $env:GITHUB_ENV - default-shell: pwsh - - stable-diffusion-model: stable-diffusion-1.5 - stable-diffusion-model-url: https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt - stable-diffusion-model-dl-path: models/ldm/stable-diffusion-v1 - stable-diffusion-model-dl-name: v1-5-pruned-emaonly.ckpt - name: ${{ matrix.environment-yaml }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - env: - CONDA_ENV_NAME: invokeai - INVOKEAI_ROOT: '${{ github.workspace }}/invokeai' - defaults: - run: - shell: ${{ matrix.default-shell }} - steps: - - name: Checkout sources - id: checkout-sources - uses: actions/checkout@v3 - - - name: create models.yaml from example - run: | - mkdir -p ${{ env.INVOKEAI_ROOT }}/configs - cp configs/models.yaml.example ${{ env.INVOKEAI_ROOT }}/configs/models.yaml - - - name: create environment.yml - run: cp "environments-and-requirements/${{ matrix.environment-yaml }}" environment.yml - - - name: Use cached conda packages - id: use-cached-conda-packages - uses: actions/cache@v3 - with: - path: ~/conda_pkgs_dir - key: conda-pkgs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(matrix.environment-yaml) }} - - - name: Activate Conda Env - id: activate-conda-env - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: ${{ env.CONDA_ENV_NAME }} - environment-file: environment.yml - miniconda-version: latest - - - name: set test prompt to main branch validation - if: ${{ github.ref == 'refs/heads/main' }} - run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> ${{ matrix.github-env }} - - - name: set test prompt to development branch validation - if: ${{ github.ref == 'refs/heads/development' }} - run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> ${{ matrix.github-env }} - - - name: set test prompt to Pull Request validation - if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }} - run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.github-env }} - - - name: Use Cached Stable Diffusion Model - id: cache-sd-model - uses: actions/cache@v3 - env: - cache-name: cache-${{ matrix.stable-diffusion-model }} - with: - path: ${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }} - key: ${{ env.cache-name }} - - - name: Download ${{ matrix.stable-diffusion-model }} - id: download-stable-diffusion-model - if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }} - run: | - mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}" - ${{ matrix.curl-command }} -H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" -o "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}/${{ matrix.stable-diffusion-model-dl-name }}" -L ${{ matrix.stable-diffusion-model-url }} - - - name: run configure_invokeai.py - id: run-preload-models - run: | - python scripts/configure_invokeai.py --no-interactive --yes - - - name: cat invokeai.init - id: cat-invokeai - run: cat ${{ env.INVOKEAI_ROOT }}/invokeai.init - - - name: Run the tests - id: run-tests - if: matrix.os != 'windows-2022' - run: | - time python scripts/invoke.py \ - --no-patchmatch \ - --no-nsfw_checker \ - --model ${{ matrix.stable-diffusion-model }} \ - --from_file ${{ env.TEST_PROMPTS }} \ - --root="${{ env.INVOKEAI_ROOT }}" \ - --outdir="${{ env.INVOKEAI_ROOT }}/outputs" - - - name: export conda env - id: export-conda-env - if: matrix.os != 'windows-2022' - run: | - mkdir -p outputs/img-samples - conda env export --name ${{ env.CONDA_ENV_NAME }} > ${{ env.INVOKEAI_ROOT }}/outputs/environment-${{ runner.os }}-${{ runner.arch }}.yml - - - name: Archive results - if: matrix.os != 'windows-2022' - id: archive-results - uses: actions/upload-artifact@v3 - with: - name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }} - path: ${{ env.INVOKEAI_ROOT }}/outputs From 1c7e65102e4593546aee37d580d0068f22060bd8 Mon Sep 17 00:00:00 2001 From: Eugene Brodsky Date: Sun, 11 Dec 2022 16:38:22 -0500 Subject: [PATCH 6/8] (ci) revert to only build 'v*' tags because this is consistent with the release process --- .github/workflows/build-cloud-img.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cloud-img.yml b/.github/workflows/build-cloud-img.yml index 2297a06bae..0cc3ab2e08 100644 --- a/.github/workflows/build-cloud-img.yml +++ b/.github/workflows/build-cloud-img.yml @@ -5,7 +5,7 @@ on: branches: - main tags: - - "*" + - v* concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 6e41f3a17ca62b74a7d9cb072686d8e7e44fd906 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Tue, 13 Dec 2022 14:59:27 -0500 Subject: [PATCH 7/8] add github.run_id to group to prevent cancelling main branch workflows --- .github/workflows/build-cloud-img.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cloud-img.yml b/.github/workflows/build-cloud-img.yml index 0cc3ab2e08..28762bf1ec 100644 --- a/.github/workflows/build-cloud-img.yml +++ b/.github/workflows/build-cloud-img.yml @@ -8,7 +8,7 @@ on: - v* concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true permissions: From 82b2e96700bdbe5774d08e7f1ad31b5f14d4d22d Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Tue, 13 Dec 2022 15:00:47 -0500 Subject: [PATCH 8/8] add github.run_id to group to prevent cancelling main branch workflows (container) --- .github/workflows/build-container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 689de12741..21c6a667ac 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -5,7 +5,7 @@ on: - 'main' concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: