Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add check_export #22

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/check_export.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: check-export
env:
REFLEX_DEP: 'reflex'
TELEMETRY_ENABLED: false
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
reflex_dep:
description: 'Reflex dep (raw pip spec)'

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
# TODO fix stable_diffusion export (gets stuck)
EXAMPLES="$(find . -not -name '.*' -maxdepth 1 -type d | cut -f2 -d/ | sort | grep -vw chakra_apps | 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

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 "requirements.txt does not contain 'reflex'"
exit 1
fi

python -m venv venv
source venv/bin/activate

pip install '${{ github.event.inputs.reflex_dep || env.REFLEX_DEP }}' -r requirements.txt
export OPENAI_API_KEY="dummy"
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
2 changes: 1 addition & 1 deletion dashboard/dashboard/backend/table_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def total_pages(self) -> int:
1 if self.total_items % self.limit else 0
)

@rx.var(cache=True)
@rx.var(cache=True, initial_value=[])
def get_current_page(self) -> list[Item]:
start_index = self.offset
end_index = start_index + self.limit
Expand Down
Loading