From 5ee5b9c7bfcac30f999880db82fb96bee62eb8a6 Mon Sep 17 00:00:00 2001 From: mauwii Date: Fri, 28 Oct 2022 17:46:04 +0200 Subject: [PATCH 1/5] add tests/validate_pr_prompt.txt --- tests/validate_pr_prompt.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/validate_pr_prompt.txt diff --git a/tests/validate_pr_prompt.txt b/tests/validate_pr_prompt.txt new file mode 100644 index 00000000000..c1a8e00cbef --- /dev/null +++ b/tests/validate_pr_prompt.txt @@ -0,0 +1 @@ +banana sushi -Ak_lms -S42 -s10 From ebf2530c09f7acaf9ae89496d42dd36f393033cf Mon Sep 17 00:00:00 2001 From: mauwii Date: Fri, 28 Oct 2022 17:54:50 +0200 Subject: [PATCH 2/5] prevent secret leakage with pull_request_target - in this way the action is used from the base repository - also use new secret HUGGINGFACE_TOKEN (username:token) - f.e. `noreply@github.com:hf_lkaugfklagwrjglaslzfgkjzzf` - change pr prompt file to validate_pr_prompt.txt --- .github/workflows/test-invoke-conda.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-invoke-conda.yml b/.github/workflows/test-invoke-conda.yml index 5ce25ab3f50..2e0540e60cc 100644 --- a/.github/workflows/test-invoke-conda.yml +++ b/.github/workflows/test-invoke-conda.yml @@ -4,7 +4,7 @@ on: branches: - 'main' - 'development' - pull_request: + pull_request_target: branches: - 'main' - 'development' @@ -48,7 +48,7 @@ jobs: - name: set test prompt to Pull Request validation if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }} - run: echo "TEST_PROMPTS=tests/pr_prompt.txt" >> $GITHUB_ENV + run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> $GITHUB_ENV - name: set conda environment name run: echo "CONDA_ENV_NAME=invokeai" >> $GITHUB_ENV @@ -69,7 +69,8 @@ jobs: [[ -d models/ldm/stable-diffusion-v1 ]] \ || mkdir -p models/ldm/stable-diffusion-v1 [[ -r models/ldm/stable-diffusion-v1/model.ckpt ]] \ - || curl -o models/ldm/stable-diffusion-v1/model.ckpt ${{ secrets.SD_V1_4_URL }} + || curl --user "${{ secrets.HUGGINGFACE_TOKEN }}" \ + -O -L https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt - name: Activate Conda Env uses: conda-incubator/setup-miniconda@v2 From 31bd39f9fbb1aa6b1165cd5c4f863ead1a0ad160 Mon Sep 17 00:00:00 2001 From: mauwii Date: Fri, 28 Oct 2022 18:00:51 +0200 Subject: [PATCH 3/5] add forgotten output-file --- .github/workflows/test-invoke-conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-invoke-conda.yml b/.github/workflows/test-invoke-conda.yml index 2e0540e60cc..1bed3433e90 100644 --- a/.github/workflows/test-invoke-conda.yml +++ b/.github/workflows/test-invoke-conda.yml @@ -70,6 +70,7 @@ jobs: || mkdir -p models/ldm/stable-diffusion-v1 [[ -r models/ldm/stable-diffusion-v1/model.ckpt ]] \ || curl --user "${{ secrets.HUGGINGFACE_TOKEN }}" \ + -o models/ldm/stable-diffusion-v1/model.ckpt \ -O -L https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt - name: Activate Conda Env From 7cb1e06b20ce8ec184ccb15d82b30e13ff6fa258 Mon Sep 17 00:00:00 2001 From: mauwii Date: Fri, 28 Oct 2022 19:35:01 +0200 Subject: [PATCH 4/5] also update create-caches.yml imho this could also be deleted, not sure what it is used for --- .github/workflows/create-caches.yml | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/.github/workflows/create-caches.yml b/.github/workflows/create-caches.yml index bbd95f58d85..33ea3b82ed1 100644 --- a/.github/workflows/create-caches.yml +++ b/.github/workflows/create-caches.yml @@ -54,27 +54,9 @@ jobs: [[ -d models/ldm/stable-diffusion-v1 ]] \ || mkdir -p models/ldm/stable-diffusion-v1 [[ -r models/ldm/stable-diffusion-v1/model.ckpt ]] \ - || curl -o models/ldm/stable-diffusion-v1/model.ckpt ${{ secrets.SD_V1_4_URL }} - - - name: Use cached Conda Environment - uses: actions/cache@v3 - env: - cache-name: cache-conda-env-${{ env.CONDA_ENV_NAME }} - conda-env-file: ${{ matrix.environment-file }} - with: - path: ${{ env.CONDA_ROOT }}/envs/${{ env.CONDA_ENV_NAME }} - key: ${{ env.cache-name }} - restore-keys: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(env.conda-env-file) }} - - - name: Use cached Conda Packages - uses: actions/cache@v3 - env: - cache-name: cache-conda-env-${{ env.CONDA_ENV_NAME }} - conda-env-file: ${{ matrix.environment-file }} - with: - path: ${{ env.CONDA_PKGS_DIR }} - key: ${{ env.cache-name }} - restore-keys: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles(env.conda-env-file) }} + || curl --user "${{ secrets.HUGGINGFACE_TOKEN }}" \ + -o models/ldm/stable-diffusion-v1/model.ckpt \ + -O -L https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt - name: Activate Conda Env uses: conda-incubator/setup-miniconda@v2 From 81f2187249b5e82a47ca583f5fca2adea78c43f7 Mon Sep 17 00:00:00 2001 From: mauwii Date: Fri, 28 Oct 2022 19:47:24 +0200 Subject: [PATCH 5/5] use sd-model link from matrix this enables running tests with diffferent models --- .github/workflows/test-invoke-conda.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-invoke-conda.yml b/.github/workflows/test-invoke-conda.yml index 1bed3433e90..65e3e4e1e2d 100644 --- a/.github/workflows/test-invoke-conda.yml +++ b/.github/workflows/test-invoke-conda.yml @@ -19,9 +19,11 @@ jobs: - os: ubuntu-latest environment-file: environment.yml default-shell: bash -l {0} + stable-diffusion-model: https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt - os: macos-latest environment-file: environment-mac.yml default-shell: bash -l {0} + stable-diffusion-model: https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt name: Test invoke.py on ${{ matrix.os }} with conda runs-on: ${{ matrix.os }} defaults: @@ -57,7 +59,7 @@ jobs: id: cache-sd-v1-4 uses: actions/cache@v3 env: - cache-name: cache-sd-v1-4 + cache-name: cache-sd-${{ matrix.stable-diffusion-model }} with: path: models/ldm/stable-diffusion-v1/model.ckpt key: ${{ env.cache-name }} @@ -71,7 +73,7 @@ jobs: [[ -r models/ldm/stable-diffusion-v1/model.ckpt ]] \ || curl --user "${{ secrets.HUGGINGFACE_TOKEN }}" \ -o models/ldm/stable-diffusion-v1/model.ckpt \ - -O -L https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt + -O -L ${{ matrix.stable-diffusion-model }} - name: Activate Conda Env uses: conda-incubator/setup-miniconda@v2