-
Notifications
You must be signed in to change notification settings - Fork 364
110 lines (101 loc) · 3.2 KB
/
Copy pathcheck_export.yml
File metadata and controls
110 lines (101 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: check-export
env:
REFLEX_REPO: 'reflex-dev/reflex'
REFLEX_REF: 'main'
REFLEX_TELEMETRY_ENABLED: false
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
reflex_ref:
description: 'Reflex git ref to check out from reflex-dev/reflex'
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: |
EXAMPLES="$(find . -not -name '.*' -maxdepth 1 -type d | cut -f2 -d/ | sort | grep -vw chat_v2 | jq -R | jq -s -c)"
echo $EXAMPLES
echo "examples=$EXAMPLES" >> $GITHUB_OUTPUT
check-export:
needs: [list-examples]
strategy:
fail-fast: false
matrix:
example: ${{ fromJSON(needs.list-examples.outputs.examples) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: ${{ env.REFLEX_REPO }}
ref: ${{ github.event.inputs.reflex_ref || env.REFLEX_REF }}
path: _reflex
fetch-depth: 0
fetch-tags: true
- 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 uv
REFLEX_DIR="$GITHUB_WORKSPACE/_reflex" python - <<'PY'
import os, re
reflex_dir = os.environ["REFLEX_DIR"]
with open("requirements.txt") as f:
lines = f.read().splitlines()
out = []
for line in lines:
m = re.match(r"^(reflex(?:\[[^\]]+\])?)\s*(?:[<>=!~].*)?$", line)
if m:
out.append(f"{m.group(1)} @ file://{reflex_dir}")
else:
out.append(line)
with open("requirements.txt", "w") as f:
f.write("\n".join(out) + "\n")
PY
cat requirements.txt
uv pip install -r requirements.txt
export OPENAI_API_KEY="dummy"
reflex init
reflex export | tee export_logs.txt
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
- name: Check for DeprecationWarning in logs
run: |
cd ${{ matrix.example }}
dep_lines=$(grep -i "DeprecationWarning:" export_logs.txt || true)
if [ -n "$dep_lines" ]; then
echo "Found Deprecation warning:"
echo "$dep_lines"
exit 1
else
echo "No deprecated code, all good."
fi