Skip to content

fix linting

fix linting #122

Workflow file for this run

name: Deploy on EC2
on:
push:
branches: [master]
workflow_dispatch:
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install Requirements
run: |
pip install --upgrade pip
pip install -r dev-requirements.txt
pip install -r requirements.txt
- name: Run PyLint
run: pylint ./src
- name: Prepare TestBed
run: |
sudo apt-get update -y
sudo apt-get install -y libopus-dev
- name: Test Run Boi
run: |
python src/main.py &
sleep 20
kill "$!"
env:
BOT_TOKEN: ${{ secrets.TEST_BOI_DC_TOKEN }}
SERVER_IP: ${{ secrets.SERVER_IP }}
SERVER_PORT: ${{ secrets.SERVER_PORT }}
SERVER_ENDPOINT: ${{ secrets.SERVER_ENDPOINT }}
WAVELINK_URL: ${{ secrets.WAVELINK_URL }}
WAVELINK_PORT: ${{ secrets.WAVELINK_PORT }}
WAVELINK_PASSWORD: ${{ secrets.WAVELINK_PASSWORD }}
docker_build:
name: Build and push docker container
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
context: .
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/wkk-offcial/boi_redemption_arc:latest
deploy:
name: Deploy to EC2
needs: docker_build
runs-on: ubuntu-latest
steps:
- name: Deploy Image on EC2
uses: appleboy/[email protected]
env:
DISCORD_TOKEN: ${{ secrets.BOI_DISCORD_TOKEN }}
SERVER_IP: ${{ secrets.SERVER_IP }}
SERVER_PORT: ${{ secrets.SERVER_PORT }}
SERVER_ENDPOINT: ${{ secrets.SERVER_ENDPOINT }}
DOCKER_BOI_IMAGE: "ghcr.io/wkk-offcial/boi_redemption_arc:latest"
DOCKER_BOI_NAME: "wkk_boi"
WAVELINK_URL: ${{ secrets.WAVELINK_URL }}
WAVELINK_PORT: ${{ secrets.WAVELINK_PORT }}
WAVELINK_PASSWORD: ${{ secrets.WAVELINK_PASSWORD }}
with:
host: ${{secrets.BOI_HOSTNAME}}
username: opc
key: ${{secrets.BOI_PRIVATE_KEY}}
envs: DISCORD_TOKEN, SERVER_IP, SERVER_ENDPOINT, SERVER_PORT, DOCKER_BOI_IMAGE, DOCKER_BOI_NAME, WAVELINK_URL, WAVELINK_PORT, WAVELINK_PASSWORD
script_stop: true
script: |
if [[ -z "$(docker network ls | grep wkk-network)" ]]; then
docker network create wkk-network
fi
docker pull $DOCKER_BOI_IMAGE
docker stop $DOCKER_BOI_NAME && docker rm -fv $DOCKER_BOI_NAME || true
docker run --restart unless-stopped \
--detach \
--network="wkk-network" \
-e BOT_TOKEN=$DISCORD_TOKEN \
-e SERVER_IP=$SERVER_IP \
-e SERVER_PORT=$SERVER_PORT \
-e SERVER_ENDPOINT=$SERVER_ENDPOINT \
-e WAVELINK_URL=$WAVELINK_URL \
-e WAVELINK_PORT=$WAVELINK_PORT \
-e WAVELINK_PASSWORD=$WAVELINK_PASSWORD \
-v /home/opc/soundboards:/wkk-bot/cache/soundboards \
--name $DOCKER_BOI_NAME \
$DOCKER_BOI_IMAGE
docker image prune <<< y