Skip to content

Commit

Permalink
🚢 test: pytest on master push for codecov pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerohertz committed Oct 31, 2024
1 parent f715835 commit bba608d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/cicd-pr-dev-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ jobs:
- name: Run tests
env:
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/cicd-push-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ jobs:
- name: Run tests
env:
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/cicd-push-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,64 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CHECK }}
if: always()

test:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Cache virtualenv
uses: actions/cache@v4
with:
path: venv
key: ${{ runner.os }}-python-venv
restore-keys: |
${{ runner.os }}-python-venv-
- name: Run tests
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
run: |
source venv/bin/activate
sudo apt update
sudo apt install python3-opencv -y
pip install pytest pytest-cov
pytest --cov --cov-report=xml --junitxml=junit.xml -o junit_family=legacy
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
flags: python3.11
token: ${{ secrets.CODECOV_TOKEN }}
if: always()

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: always()

- name: Slack webhook
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: zerohertzLib
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
if_mention: failure,cancelled
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CHECK }}
if: always()

# deploy-github:
# runs-on: ubuntu-latest
# needs: [build]
Expand Down

0 comments on commit bba608d

Please sign in to comment.