-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 3.11 KB
/
Copy pathpythonapp.yml
File metadata and controls
80 lines (68 loc) · 3.11 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
name: Python application
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install PostgreSQL
run: |
sudo apt-get update
sudo apt-get install -qy postgresql postgresql-server-dev-14 sudo
sudo service postgresql start
- name: Setup database
env:
dbpwd: ${{ secrets.localdb_password }}
run: |
user=$(id -u -n)
sudo -u postgres psql -v ON_ERROR_STOP=1 -c "CREATE DATABASE ttgcbot"
sudo -u postgres psql -v ON_ERROR_STOP=1 -c "CREATE USER "$user" ENCRYPTED PASSWORD '"$dbpwd"';"
sudo -u postgres psql -v ON_ERROR_STOP=1 -c "GRANT ALL PRIVILEGES ON DATABASE ttgcbot TO "$user";"
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/tables.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/triggers.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/procedures.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/lang_features.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/userblock_features.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/pet.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/skill_and_kill_features.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/map.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/swap.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/jdr_rewrite.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/jdr_v4.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/jdr_v5.sql
psql -v ON_ERROR_STOP=1 -p 5432 -d ttgcbot -f database-scripts/final.sql
- name: Create config file
env:
token: ${{ secrets.token }}
dbpwd: ${{ secrets.localdb_password }}
run: |
echo '{"token": "'$token'", "database": {"name": "ttgcbot", "user": "'$(id -u -n)'", "password": "'$dbpwd'"}}' > config/config.staging.json
- name: Launch application
run: |
timeout --preserve-status -s SIGINT --kill-after=30 60 python3 TtgcBot.py staging
- name: Approve pull request
if: github.event_name == 'pull_request'
uses: andrewmusgrave/automatic-pull-request-review@0.0.2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Dump databases and gather artifacts
if: ${{ failure() }}
run: |
mkdir output
pg_dump ttgcbot > output/dump_bot.sql
cp -R Logs/ output/Logs/
- name: Upload artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2.1.4
with:
name: artifacts
path: output/
if-no-files-found: warn