-
-
Notifications
You must be signed in to change notification settings - Fork 277
125 lines (124 loc) · 4.13 KB
/
rough-test.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
name: Rough Test
on:
pull_request: ~
workflow_dispatch: ~
push:
branches-ignore:
- dependabot/**
jobs:
test:
strategy:
fail-fast: false
matrix:
version: [ '3.9', '3.10', '3.11', '3.12' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
name: Python ${{ matrix.version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.version }}
cache: 'pip'
- name: Install dependencies
shell: bash
run: |
set -eux
python -m pip install --upgrade pip wheel setuptools
pip install -r requirements.txt
- name: Setup PostgreSQL
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
set -eux
sudo apt-get -yq update
sudo apt-get -yq install postgresql
sudo systemctl start postgresql
sudo -u postgres psql -c "CREATE USER test WITH PASSWORD 'test';"
sudo -u postgres psql -c "CREATE DATABASE test OWNER test;"
- name: Prepare environment
shell: bash
run: |
set -eux
echo 'TOKEN=test' > .env_sqlite
echo 'MANAGER=-1' >> .env_sqlite
echo 'DEBUG=1' >> .env_sqlite
echo "PORT=$((RANDOM + 16384))" >> .env_sqlite
echo 'TABLE_TO_IMAGE=1' >> .env_sqlite
echo 'MULTIPROCESSING=1' >> .env_sqlite
cp .env_sqlite .env_postgresql
echo 'DATABASE_URL=postgres://test:test@localhost:5432/test' >> .env_postgresql
ln -s src rsstt
- name: Test RSS-to-Telegram-Bot (SQLite)
shell: bash
run: |
set -eux
cp .env_sqlite .env
python3 -u telegramRSSbot.py
- name: Test RSS-to-Telegram-Bot as a Python package (SQLite)
shell: bash
run: |
set -eux
python3 -m rsstt
- name: Test RSS-to-Telegram-Bot (PostgreSQL)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
set -eux
cp .env_postgresql .env
python3 -u telegramRSSbot.py
- name: Test RSS-to-Telegram-Bot as a Python package (PostgreSQL)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
set -eux
python3 -m rsstt
- name: Test scripts/aerich_helper.py (SQLite)
shell: bash
run: |
set -eux
./scripts/aerich_helper.py -h
./scripts/aerich_helper.py -v history
./scripts/aerich_helper.py -v heads
./scripts/aerich_helper.py -v upgrade True
- name: Test scripts/aerich_helper.py (PostgreSQL)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
set -eux
. .env_postgresql
./scripts/aerich_helper.py -v -u "$DATABASE_URL" history
./scripts/aerich_helper.py -v -u "$DATABASE_URL" heads
./scripts/aerich_helper.py -v -u "$DATABASE_URL" upgrade True
- name: Test aerich migration upgrade (SQLite)
shell: bash
run: |
set -eux
rm -rf config
cp .env_sqlite .env
CURR_REF="$(git rev-parse HEAD)"
git checkout stale/aerich-0.6
pip install -qr requirements.txt
python3 -u telegramRSSbot.py
git checkout "$CURR_REF"
pip install -qr requirements.txt
python3 -u telegramRSSbot.py
- name: Test aerich migration upgrade (PostgreSQL)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
set -eux
sudo -u postgres psql -c "DROP DATABASE test;"
sudo -u postgres psql -c "CREATE DATABASE test OWNER test;"
cp .env_postgresql .env
CURR_REF="$(git rev-parse HEAD)"
git checkout stale/aerich-0.6
pip install -qr requirements.txt
python3 -u telegramRSSbot.py
git checkout "$CURR_REF"
pip install -qr requirements.txt
python3 -u telegramRSSbot.py