Skip to content

♻️ refactor: Add view count to post.html #77

♻️ refactor: Add view count to post.html

♻️ refactor: Add view count to post.html #77

Workflow file for this run

name: CI/CD
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
build:
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
REDIS_URL: ${{ secrets.REDIS_URL }}
DJANGO_ADMIN_URL: ${{ secrets.DJANGO_ADMIN_URL }}
DJANGO_SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }}
DJANGO_LIARA_ENDPOINT: ${{ secrets.DJANGO_LIARA_ENDPOINT }}
DJANGO_LIARA_BUCKET_NAME: ${{ secrets.DJANGO_LIARA_BUCKET_NAME }}
DJANGO_LIARA_ACCESS_KEY: ${{ secrets.DJANGO_LIARA_ACCESS_KEY }}
DJANGO_LIARA_SECRET_KEY: ${{ secrets.DJANGO_LIARA_SECRET_KEY }}
DJANGO_SETTINGS_MODULE: ${{ secrets.DJANGO_SETTINGS_MODULE }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Make Migrations
run: python manage.py makemigrations
- name: Migrate Database
run: python manage.py migrate
- name: Run Tests
run: python manage.py test
test:
needs: build
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
REDIS_URL: ${{ secrets.REDIS_URL }}
DJANGO_ADMIN_URL: ${{ secrets.DJANGO_ADMIN_URL }}
DJANGO_SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }}
DJANGO_LIARA_ENDPOINT: ${{ secrets.DJANGO_LIARA_ENDPOINT }}
DJANGO_LIARA_BUCKET_NAME: ${{ secrets.DJANGO_LIARA_BUCKET_NAME }}
DJANGO_LIARA_ACCESS_KEY: ${{ secrets.DJANGO_LIARA_ACCESS_KEY }}
DJANGO_LIARA_SECRET_KEY: ${{ secrets.DJANGO_LIARA_SECRET_KEY }}
DJANGO_SETTINGS_MODULE: ${{ secrets.DJANGO_SETTINGS_MODULE }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Make Migrations
run: python manage.py makemigrations
- name: Migrate Database
run: python manage.py migrate
- name: Run Tests
run: coverage run manage.py test
- name: show coverage report
run: coverage report
- name: generate coverage report
run: coverage xml -i
- name: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path_magic_file: ${{ github.workspace }}\\tests\\files\\magic.mgc
run: coveralls --service=github
- name: Coveralls Finished report
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
parallel-finished: true
flag-name: github_action_tests
base-path: '.'
debug: true
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Update Liara and Deploy
env:
LIARA_TOKEN: ${{ secrets.LIARA_API_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
REDIS_URL: ${{ secrets.REDIS_URL }}
DJANGO_ADMIN_URL: ${{ secrets.DJANGO_ADMIN_URL }}
DJANGO_SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }}
DJANGO_LIARA_ENDPOINT: ${{ secrets.DJANGO_LIARA_ENDPOINT }}
DJANGO_LIARA_BUCKET_NAME: ${{ secrets.DJANGO_LIARA_BUCKET_NAME }}
DJANGO_LIARA_ACCESS_KEY: ${{ secrets.DJANGO_LIARA_ACCESS_KEY }}
DJANGO_LIARA_SECRET_KEY: ${{ secrets.DJANGO_LIARA_SECRET_KEY }}
DJANGO_SETTINGS_MODULE: ${{ secrets.DJANGO_SETTINGS_MODULE }}
run: |
npm install -g @liara/cli@3
liara deploy --app="rezashakeri" --api-token="$LIARA_TOKEN" --detach