refactor: replace deprecated datetime.utcnow() #1045
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |