Skip to content

Commit 0237007

Browse files
committed
Environment testing for gh workflows [skip ci]
1 parent efadabb commit 0237007

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/build-env.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build Env
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
UBUNTU_VERSION: 22.04
8+
BUILDX_NO_DEFAULT_ATTESTATIONS: 1
9+
# Conservative defaults for cloud providers
10+
LATEST_CPU: "newbase-2.2.0-py3.10-cpu-22.04"
11+
12+
jobs:
13+
cpu-base:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
var:
19+
- {latest: "true", sha: "", python: "3.10", pytorch: "2.2.0"}
20+
- {latest: "false", sha: "abc1234", python: "3.10", pytorch: "2.2.0"}
21+
steps:
22+
-
23+
name: Env Setter
24+
run: |
25+
echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
26+
-
27+
name: Set tags
28+
run: |
29+
img_path="ghcr.io/${{ env.PACKAGE_NAME }}"
30+
echo "Image Path: ${img_path}"
31+
if [[ -z '${{ matrix.var.sha }}' ]]; then
32+
COMFYUI_SHA="$(curl -fsSL "https://api.github.com/repos/comfyanonymous/ComfyUI/commits/master" | jq -r '.sha[0:7]')"
33+
else
34+
COMFYUI_SHA="${{ matrix.var.sha }}"
35+
fi
36+
[ -z "$COMFYUI_SHA" ] && { echo "Error: COMFYUI_SHA is empty. Exiting script." >&2; exit 1; }
37+
38+
base_tag="newbase-${{ matrix.var.pytorch }}-py${{ matrix.var.python }}-cpu-${{ env.UBUNTU_VERSION }}"
39+
echo "Base Tag: ${base_tag}"
40+
sha_tag="${COMFYUI_SHA}-${base_tag}"
41+
echo "SHA Tag: ${sha_tag}"
42+
TAGS="${img_path}:${sha_tag}"
43+
if [[ ${{ matrix.var.latest }} == "true" ]]; then
44+
echo "Marking latest"
45+
TAGS+=", ${img_path}:latest-cpu, ${img_path}:latest-cpu-jupyter"
46+
fi
47+
echo "All Tags: ${TAGS}"
48+
echo "COMFYUI_SHA=${COMFYUI_SHA}" >> ${GITHUB_ENV}
49+
echo "TAGS=${TAGS}" >> ${GITHUB_ENV}
50+
# Print envs
51+
env

0 commit comments

Comments
 (0)