Changed DEBUG logic to be True by default #3
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
# Useful links | |
# - https://docs.github.com/en/actions/learn-github-actions/variables | |
# - https://github.com/dokku/github-action/issues/8 | |
# | |
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
name: Run linting and tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
make install | |
- name: Run linter | |
run: make lint | |
- name: Run tests | |
run: make test | |
- name: Code Climate Coverage Action | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
with: | |
coverageCommand: make coverage_xml | |
deploy: | |
name: Deploy app on Dokku Server | |
runs-on: ubuntu-latest | |
needs: test | |
if: ${{ needs.test.result == 'success' }} | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Push to Dokku | |
uses: dokku/github-action@master | |
with: | |
git_push_flags: '--force' | |
branch: main | |
git_remote_url: ssh://${{ secrets.DOKKU_USERNAME }}@${{ secrets.DOKKU_SERVER_IP }}:22/~/${{ secrets.DOKKU_APP_NAME }} | |
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
notify: | |
name: Send Slack Notification | |
runs-on: ubuntu-latest | |
needs: [test, deploy] | |
if: always() | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Slack Notification on Success | |
if: ${{ needs.test.result == 'success' && needs.deploy.result == 'success' }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_ICON: https://www.google.com/s2/favicons?domain=github.com&sz=128 | |
SLACK_COLOR: "good" | |
SLACK_USERNAME: "GitHub Actions" | |
SLACK_TITLE: > | |
🟢 CI/CD Pipeline Succeeded for "${{ github.repository }}" project | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
- name: Slack Notification on Failure | |
if: ${{ needs.test.result == 'failure' || needs.deploy.result == 'failure' }} | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_ICON: https://www.google.com/s2/favicons?domain=github.com&sz=128 | |
SLACK_COLOR: "danger" | |
SLACK_USERNAME: "GitHub Actions" | |
SLACK_TITLE: > | |
❌ CI/CD Workflow Failed for "${{ github.repository }}" project | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |