Skip to content

fix: update selector for leetcode #59

fix: update selector for leetcode

fix: update selector for leetcode #59

Workflow file for this run

name: Deploy via SSH
on:
push:
branches: [main]
paths-ignore:
- "*.md"
jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: [3.9]
poetry-version: [1.1.6]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get full Python version
id: full-python-version
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Bootstrap poetry
run: |
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \
| python - -y --git https://github.com/python-poetry/poetry.git
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v2
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Install dependencies
shell: bash
run: poetry install
- name: Run tests
run: |
poetry run pytest
deploy:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Backup & Migrate Database + Restart Latest App
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
cd ${{ secrets.REMOTE_DIR }}
git pull
git reset --hard origin/main
${{ secrets.POETRY_PATH }} install
chmod +x ./backups/pg_backup.sh
./backups/pg_backup.sh ${{ secrets.REMOTE_DIR }}
env MANUAL_PATH=1 ./run_migrations.sh ${{ secrets.POETRY_PATH }}
pm2 restart coding-questions-bot
echo =========== Deployment Completed ===========