-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (109 loc) · 4.54 KB
/
main.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
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