-
-
Notifications
You must be signed in to change notification settings - Fork 89
167 lines (163 loc) · 6.79 KB
/
bundling.yml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: App Bundling
run-name: Bundling on GitHub Actions 🚀 triggered by ${{ github.actor }}
# run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
# https://stackoverflow.com/a/58142412/13174934
on:
push:
branches:
- "S8.1-bundling-the-app"
jobs:
# Explore-GitHub-Actions:
# runs-on: ubuntu-latest
# steps:
# - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
# - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
# - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
# - name: Check out repository code
# uses: actions/checkout@v4
# - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
# - run: echo "🖥️ The workflow is now ready to test your code on the runner."
# - name: List files in the repository
# run: |
# ls ${{ github.workspace }}
# - run: echo "🍏 This job's status is ${{ job.status }}."
build-frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./text2sql-frontend
steps:
- uses: actions/checkout@v4
- name: Install Nodejs
uses: actions/setup-node@v4
with:
# TODO: use newer version once this works
node-version: "20"
- name: Install npm packages
run: npm install
- name: Build the frontend
env:
NODE_ENV: local
run: npm run build
- name: Prepare assets for use by backend
run: |
cp -r dist/assets/ assets
cp dist/favicon.ico assets/favicon.ico
cp dist/manifest.json assets/manifest.json
- uses: actions/upload-artifact@v4
with:
name: frontend-artifact
# default workdir is only for runs, here we are using "uses" so it does not apply
path: text2sql-frontend/assets/
overwrite: true
bundle-linux:
runs-on: ubuntu-latest
needs: build-frontend
defaults:
run:
working-directory: ./text2sql-backend
steps:
- uses: actions/checkout@v4
- name: Download Frontend Build
uses: actions/download-artifact@v4
with:
path: ./text2sql-backend/assets/
name: frontend-artifact
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11.6
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: |
poetry self add poetry-plugin-export
poetry export --without-hashes -f requirements.txt --output requirements.txt
pip install -r requirements.txt pyinstaller==5.13.2
- name: Run pyinstaller
run: |
pyinstaller --clean --hidden-import=asyncpg.pgproto.pgproto --hidden-import=uuid --hidden-import=ipaddress --hidden-import=aiosqlite \
--add-data alembic:alembic --add-data alembic.ini:. --add-data samples:samples --add-data templates:templates --add-data assets:assets \
--collect-data llama_index --distpath ../linux_dist --hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext --collect-data=jinja2 main.py -y
- uses: actions/upload-artifact@v4
with:
name: linux-artifact
# default workdir is only for runs, here we are using "uses" so it does not apply
path: linux_dist/
overwrite: true
bundle-windows:
runs-on: windows-latest
needs: build-frontend
defaults:
run:
working-directory: ./text2sql-backend
steps:
- uses: actions/checkout@v4
- name: Download Frontend Build
uses: actions/download-artifact@v4
with:
path: ./text2sql-backend/assets/
name: frontend-artifact
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11.6
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: |
poetry self add poetry-plugin-export
poetry export --without-hashes -f requirements.txt --output requirements.txt
pip install -r requirements.txt pyinstaller==5.13.2
# - name: Setup tmate session (windows)
# uses: mxschmitt/action-tmate@v3
# if: ${{ failure() }}
- name: Run pyinstaller
run: |
pyinstaller --windowed -i ../images/logo.ico --name DataLine --clean --hidden-import=asyncpg.pgproto.pgproto --hidden-import=uuid --hidden-import=ipaddress --hidden-import=aiosqlite `
--add-data "alembic;alembic" --add-data "alembic.ini;." --add-data "samples;samples" --add-data "templates;templates" --add-data "assets;assets" `
--collect-data llama_index --distpath ../win64_dist --hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext --collect-data=jinja2 main.py -y
- uses: actions/upload-artifact@v4
with:
name: windows-artifact
# default workdir is only for runs, here we are using "uses" so it does not apply
path: win64_dist/
overwrite: true
bundle-macos:
strategy:
matrix:
os: [macos-latest, macos-latest-large]
runs-on: ${{ matrix.os }}
needs: build-frontend
defaults:
run:
working-directory: ./text2sql-backend
steps:
- uses: actions/checkout@v4
- name: Download Frontend Build
uses: actions/download-artifact@v4
with:
path: ./text2sql-backend/assets/
name: frontend-artifact
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.11.6
- name: Install poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: |
poetry self add poetry-plugin-export
poetry export --without-hashes -f requirements.txt --output requirements.txt
pip install -r requirements.txt pyinstaller==5.13.2
- name: Run pyinstaller
run: |
pyinstaller --name DataLine --windowed -i ../images/logo.icns --clean --hidden-import=asyncpg.pgproto.pgproto --hidden-import=uuid --hidden-import=ipaddress --hidden-import=aiosqlite \
--add-data alembic:alembic --add-data alembic.ini:. --add-data samples:samples --add-data templates:templates --add-data assets:assets \
--collect-data llama_index --distpath ../macos_dist --hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext --collect-data=jinja2 main.py -y
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-artifact
# default workdir is only for runs, here we are using "uses" so it does not apply
path: macos_dist/
overwrite: true