From fa8520b5ed930c794ff04ffa3bf254b3920d272a Mon Sep 17 00:00:00 2001 From: Jackie Tung Date: Mon, 11 Sep 2023 09:58:24 -0700 Subject: [PATCH 1/3] check exportability --- .github/workflows/check_export.yml | 64 ++++++++++++++++++++++++ .github/workflows/check_requirements.yml | 29 ----------- chatroom/.gitignore | 1 + clock/.gitignore | 1 + counter/.gitignore | 1 + crm/.gitignore | 1 + ecommerce/requirements.txt | 4 +- fragments/.gitignore | 1 + nba/.gitignore | 1 + snakegame/.gitignore | 1 + tailwind/.gitignore | 1 + todo/.gitignore | 1 + translator/.gitignore | 1 + traversal/.gitignore | 1 + twitter/.gitignore | 1 + upload/.gitignore | 1 + 16 files changed, 80 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/check_export.yml delete mode 100644 .github/workflows/check_requirements.yml diff --git a/.github/workflows/check_export.yml b/.github/workflows/check_export.yml new file mode 100644 index 00000000..1585d20b --- /dev/null +++ b/.github/workflows/check_export.yml @@ -0,0 +1,64 @@ +name: check-export +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + list-examples: + runs-on: ubuntu-latest + outputs: + examples: ${{ steps.generate-matrix.outputs.examples }} + steps: + - uses: actions/checkout@v3 + - name: Generate Matrix + id: generate-matrix + run: | + # TODO fix sales export + EXAMPLES="$(find . -not -name '.*' -maxdepth 1 -type d | cut -f2 -d/ | sort | grep -vw sales | jq -R | jq -s -c)" + echo $EXAMPLES + echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT + + check-export: + needs: [list-examples] + strategy: + matrix: + example: ${{ fromJSON(needs.list-examples.outputs.examples) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - run: | + f=${{ matrix.example }} + if [[ ! -d $f ]]; then + echo "$f is not a directory!" + exit 1 + fi + + if [[ ! -f $f/requirements.txt ]]; then + echo "$f/requirements.txt is MISSING" + exit 1 + fi + + if !( grep -w "^reflex" requirements.txt >/dev/null 2>&1 ); then + echo "$f/requirements.txt does not contain 'reflex'" + exit 1 + fi + + python -m venv venv + source venv/bin/activate + + # pin reflex version - no moving target + pip install reflex==0.2.7 + pip install -r requirements.txt + reflex init + reflex export + for a in frontend.zip backend.zip; do + if unzip -t "$a"; then + echo "$a prepared as expected" + else + echo "ERROR: $a is not a valid zip file" + exit 1 + fi + done diff --git a/.github/workflows/check_requirements.yml b/.github/workflows/check_requirements.yml deleted file mode 100644 index 1f471301..00000000 --- a/.github/workflows/check_requirements.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: check-requirements -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - check-requirements: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: | - RC=0 - for f in $(ls -1); do - if [[ -d $f ]]; then - if [[ ! -f $f/requirements.txt ]]; then - echo "$f/requirements.txt is MISSING" - RC=1 - continue - fi - if !( grep -w "^reflex" $f/requirements.txt >/dev/null 2>&1 ); then - echo "$f/requirements.txt does not contain 'reflex'" - RC=1 - continue - fi - fi - done - exit $RC diff --git a/chatroom/.gitignore b/chatroom/.gitignore index 4865abd0..6cc169e1 100644 --- a/chatroom/.gitignore +++ b/chatroom/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/clock/.gitignore b/clock/.gitignore index bf56ff42..f6711845 100644 --- a/clock/.gitignore +++ b/clock/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/counter/.gitignore b/counter/.gitignore index bf56ff42..f6711845 100644 --- a/counter/.gitignore +++ b/counter/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/crm/.gitignore b/crm/.gitignore index bf56ff42..f6711845 100644 --- a/crm/.gitignore +++ b/crm/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/ecommerce/requirements.txt b/ecommerce/requirements.txt index 210218f4..685db61e 100644 --- a/ecommerce/requirements.txt +++ b/ecommerce/requirements.txt @@ -1 +1,3 @@ -reflex>=0.2.0 \ No newline at end of file +reflex>=0.2.0 +icecream==2.1.1 +pandas==2.1.0 \ No newline at end of file diff --git a/fragments/.gitignore b/fragments/.gitignore index bf56ff42..f6711845 100644 --- a/fragments/.gitignore +++ b/fragments/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/nba/.gitignore b/nba/.gitignore index bf56ff42..f6711845 100644 --- a/nba/.gitignore +++ b/nba/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/snakegame/.gitignore b/snakegame/.gitignore index bf56ff42..f6711845 100644 --- a/snakegame/.gitignore +++ b/snakegame/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/tailwind/.gitignore b/tailwind/.gitignore index bf56ff42..f6711845 100644 --- a/tailwind/.gitignore +++ b/tailwind/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/todo/.gitignore b/todo/.gitignore index bf56ff42..f6711845 100644 --- a/todo/.gitignore +++ b/todo/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/translator/.gitignore b/translator/.gitignore index bf56ff42..f6711845 100644 --- a/translator/.gitignore +++ b/translator/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/traversal/.gitignore b/traversal/.gitignore index bf56ff42..f6711845 100644 --- a/traversal/.gitignore +++ b/traversal/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/twitter/.gitignore b/twitter/.gitignore index bf56ff42..f6711845 100644 --- a/twitter/.gitignore +++ b/twitter/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ diff --git a/upload/.gitignore b/upload/.gitignore index bf56ff42..f6711845 100644 --- a/upload/.gitignore +++ b/upload/.gitignore @@ -1,3 +1,4 @@ +*.db *.py[cod] .web __pycache__/ From f1b72609ed2d77ed287a0120216e53ee35dfd342 Mon Sep 17 00:00:00 2001 From: Jackie Tung Date: Mon, 11 Sep 2023 11:20:16 -0700 Subject: [PATCH 2/3] fix --- .github/workflows/check_export.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check_export.yml b/.github/workflows/check_export.yml index 1585d20b..94b885b4 100644 --- a/.github/workflows/check_export.yml +++ b/.github/workflows/check_export.yml @@ -36,13 +36,15 @@ jobs: exit 1 fi - if [[ ! -f $f/requirements.txt ]]; then - echo "$f/requirements.txt is MISSING" + cd "$f" + + if [[ ! -f requirements.txt ]]; then + echo "requirements.txt is MISSING" exit 1 fi if !( grep -w "^reflex" requirements.txt >/dev/null 2>&1 ); then - echo "$f/requirements.txt does not contain 'reflex'" + echo "requirements.txt does not contain 'reflex'" exit 1 fi From cc60c02e32f3996e49c9c7d8f15be656f3b5b7ca Mon Sep 17 00:00:00 2001 From: Jackie Tung Date: Mon, 11 Sep 2023 11:30:32 -0700 Subject: [PATCH 3/3] exclude stable_diffusion as well --- .github/workflows/check_export.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check_export.yml b/.github/workflows/check_export.yml index 94b885b4..0b8efdf8 100644 --- a/.github/workflows/check_export.yml +++ b/.github/workflows/check_export.yml @@ -16,7 +16,8 @@ jobs: id: generate-matrix run: | # TODO fix sales export - EXAMPLES="$(find . -not -name '.*' -maxdepth 1 -type d | cut -f2 -d/ | sort | grep -vw sales | jq -R | jq -s -c)" + # TODO fix stable_diffusion export (gets stuck) + EXAMPLES="$(find . -not -name '.*' -maxdepth 1 -type d | cut -f2 -d/ | sort | grep -vw sales | grep -vw stable_diffusion | jq -R | jq -s -c)" echo $EXAMPLES echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT