Skip to content

Bundling on GitHub Actions 🚀 triggered by RamiAwar #2

Bundling on GitHub Actions 🚀 triggered by RamiAwar

Bundling on GitHub Actions 🚀 triggered by RamiAwar #2

Workflow file for this run

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