Add files via upload #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Discord + Qianfan Bot CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install appbuilder-sdk qianfan nest_asyncio discord.py redis | |
- name: Set environment variables | |
env: | |
QIANFAN_ACCESS_KEY: ${{ secrets.QIANFAN_ACCESS_KEY }} | |
QIANFAN_SECRET_KEY: ${{ secrets.QIANFAN_SECRET_KEY }} | |
APPBUILDER_TOKEN: ${{ secrets.APPBUILDER_TOKEN }} | |
Review_app_id: ${{ secrets.REVIEW_APP_ID }} | |
Chat_app_id: ${{ secrets.CHAT_APP_ID }} | |
run: echo "Environment variables set." | |
- name: Run Lint | |
run: | | |
pip install flake8 | |
flake8 . | |
- name: Run Tests | |
run: | | |
# Add test command here if applicable, e.g., pytest | |
echo "No tests available." | |
- name: Run Discord Bot (Check Build) | |
env: | |
QIANFAN_ACCESS_KEY: ${{ secrets.QIANFAN_ACCESS_KEY }} | |
QIANFAN_SECRET_KEY: ${{ secrets.QIANFAN_SECRET_KEY }} | |
APPBUILDER_TOKEN: ${{ secrets.APPBUILDER_TOKEN }} | |
Review_app_id: ${{ secrets.REVIEW_APP_ID }} | |
Chat_app_id: ${{ secrets.CHAT_APP_ID }} | |
run: | | |
python main.py | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Deploy to Production | |
run: | | |
echo "Deploying..." | |
# Add your deployment script here |