Skip to content

reformatting

reformatting #416

Workflow file for this run

name: Python application
on:
push
permissions:
contents: read
jobs:
build:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oNaiPs/secrets-to-env-action@v1
with:
secrets: ${{ toJSON(secrets) }}
- name: set up Docker
run: |
sudo bash ./install_docker.sh
cat Dockerfile.compile > Dockerfile
docker build -t complements-bot-py .
- name: Check for syntax errors or undefined names
run: |
docker run complements-bot-py flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Lint with flake8
run: |
# The GitHub editor is 127 chars wide
docker run complements-bot-py flake8 . --count --max-complexity=10 --max-line-length=127 --statistics
- name: Lint with pylint
run: |
docker run complements-bot-py pylint src
- name: Typecheck with mypy
run: |
docker run complements-bot-py mypy .
test:
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: oNaiPs/secrets-to-env-action@v1
with:
secrets: ${{ toJSON(secrets) }}
- name: set up Docker
run: |
sudo bash ./install_docker.sh
echo "$FIREBASE_CONFIG" > src/.firebase_config.json
echo "TMI_TOKEN=$TMI_TOKEN" > src/.env
echo "DATABASE_URL=$DATABASE_URL" >> src/.env
echo "CLIENT_SECRET=$CLIENT_SECRET" >> src/.env
cat Dockerfile.test > Dockerfile
bash ./docker_build.sh
- name: Test with pytest
run: |
docker run complements-bot-py pytest test_complements_bot
- name: Bandit security check
run: |
docker run complements-bot-py bandit -c pyproject.toml --severity-level medium -r .
deploy:
timeout-minutes: 15
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/main' # Only deploy if this was a push to main
steps:
- uses: actions/checkout@v3
- uses: oNaiPs/secrets-to-env-action@v1
with:
secrets: ${{ toJSON(secrets) }}
- name: Copy repository contents
uses: appleboy/scp-action@master
with:
HOST: ${{ secrets.HOST_IP }}
USERNAME: ${{ secrets.VPS_USERNAME }}
PORT: ${{ secrets.VPS_PORT }}
KEY: ${{ secrets.SSH_KEY }}
source: "."
target: ${{ secrets.DEPLOY_TARGET_LOCATION }}
- name: build and run docker container on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST_IP }}
USERNAME: ${{ secrets.VPS_USERNAME }}
PORT: ${{ secrets.VPS_PORT }}
KEY: ${{ secrets.SSH_KEY }}
script: |
cd ${{ secrets.DEPLOY_TARGET_LOCATION }}
echo '${{ secrets.FIREBASE_CONFIG }}' > src/.firebase_config.json
echo "TMI_TOKEN=${{ secrets.TMI_TOKEN }}" > src/.env
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> src/.env
echo "CLIENT_SECRET=${{ secrets.CLIENT_SECRET }}" >> src/.env
chmod +x ./docker_build.sh
chmod +x ./docker_run.sh
chmod +x ./restart_24.sh
./docker_run.sh