Skip to content

Commit

Permalink
Update ignores + workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
raidensakura committed Jun 6, 2023
1 parent 20f2045 commit 1ac907e
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 7 deletions.
8 changes: 5 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
.ruff_cache
.ruff_cache/

# Translations
*.mo
Expand Down Expand Up @@ -148,8 +148,10 @@ Procfile
pyproject.toml
*.md
.*.json
docs/
Dockerfile
docker-compose.yml
LICENSE
PRIVACY.md
PRIVACY.md

# Docs
docs/
11 changes: 7 additions & 4 deletions .github/workflows/lints.yml → .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
name: Checks

on: [push, pull_request]
on:
push:
branches:
- stable
- develop
pull_request:

jobs:
code-style:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

python-version: ["3.8", "3.9", "3.10"]
name: Python ${{ matrix.python-version }} on ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/loadcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Load Modmail"

on:
push:
branches:
- stable
- develop

jobs:
load-check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
fail-fast: false

name: Load Modmail - Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache venv
id: cache-venv
uses: actions/cache@v3
with:
path: .venv
key: ${{ matrix.python-version }}-${{ hashFiles('Pipfile') }}-${{ secrets.CACHE_V }}

- name: Maybe make pipenv
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
pip install pipenv && PIPENV_VENV_IN_PROJECT=1
pipenv install --deploy
- name: Run script loadcheck.py
run: |
pipenv shell
python .github/workflows/scripts/loadcheck.py
env:
TOKEN: ${{ secrets.DISCORD_TEST_BOT }}
CONNECTION_URI: ${{ secrets.CONNECTION_URI }}
LOG_URL: https://domain.example
GUILD_ID: 616969119685935162
OWNERS: 243316261264556032,505386507440488458
DATA_COLLECTION: off
LOG_LEVEL: DEBUG

- name: Save Modmail output as Artifact
if: always() # still run if prev step failed
uses: actions/upload-artifact@v3
with:
name: "Modmail log - Python ${{ matrix.python-version }}"
path: modmail.log
31 changes: 31 additions & 0 deletions .github/workflows/scripts/loadcheck.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import subprocess
import sys
import time

from dotenv import load_dotenv

load_dotenv(".env")

python_version = subprocess.check_output(["python", "-V"]).decode("utf-8")

print(f"Starting Modmail with {python_version}")

file = open("modmail.log", "w")
proc = subprocess.Popen(
f"pipenv run bot",
stdout=file,
stderr=subprocess.STDOUT,
shell=True,
)

# let Modmail boot up
time.sleep(10)

print("Stopping Modmail")

proc.terminate()

print(f"Modmail stopped with exit code {proc.returncode()}")

sys.exit(proc.returncode())
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
.ruff_cache/

# Translations
*.mo
Expand Down

0 comments on commit 1ac907e

Please sign in to comment.