Skip to content

Add badges & rename jobs #15

Add badges & rename jobs

Add badges & rename jobs #15

Workflow file for this run

name: LLM log analyzer and SQL Test CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
python: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf ${GITHUB_WORKSPACE}/.git
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm || true
echo "some directories deleted"
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
google-cloud-sdk imagemagick \
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
mercurial apt-transport-https mono-complete libmysqlclient \
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
-y -f >/dev/null 2>&1
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/2.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir -r requirements.txt
pip install --no-cache-dir -r tests/requirements.txt
- name: Free apt & pip cache
run: |
sudo apt-get clean
sudo apt-get autoremove -y
sudo rm -rf /var/lib/apt/lists/*
sudo rm -rf /root/.cache/pip
- name: Create .env file
working-directory: .
run: |
touch .env
echo DEBUG_LEVEL=DEBUG >> .env
echo API_SERVER_PORT=8081 >> .env
echo OPENAI_API_KEY=[OPENAI_API_KEY] >> .env
echo USER_AGENT=log_analyzer >> .env
echo LANGCHAIN_PROJECT=log_analyzer >> .env
echo LANGCHAIN_TRACING_V2=true >> .env
echo LANGCHAIN_ENDPOINT=https://api.smith.langchain.com >> .env
echo LANGCHAIN_API_KEY=[LANGCHAIN_API_KEY] >> .env
echo MYSQL_HOST=mysql >> .env
echo MYSQL_PORT=3306 >> .env
echo MYSQL_USER=user >> .env
echo MYSQL_PASSWORD=pass >> .env
echo MYSQL_DATABASE=default >> .env
echo MYSQL_ROOT_PASSWORD=admin >> .env
echo PMA_GUI_PORT=8001 >> .env
echo PMA_HOST=${MYSQL_HOST} >> .env
echo PMA_PORT=${MYSQL_PORT} >> .env
echo PMA_USER=${MYSQL_USER} >> .env
echo PMA_PASSWORD=${MYSQL_PASSWORD} >> .env
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 mysql" | sudo tee -a /etc/hosts
- name: Build Docker Compose service images
run: |
docker compose build
docker image prune -f
- name: Start Docker Compose mysql server
run: |
mkdir -p volumes/log_analyzer
mkdir -p volumes/store
set -o allexport && source .env && set +o allexport
docker compose up -d mysql
sleep 15
- name: Run PyTest
working-directory: .
run: |
pytest tests
- name: Stop Docker Compose service
run: docker compose down