Don't post to slack from fork and update CI (#220) #38
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: Run Python Style Police | |
on: | |
# Allow manual runs of workflow from Actions tab | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
paths-ignore: # ignore files that don't change build output | |
- '**/*.md' | |
- .github/dependabot.yml | |
- .gitignore | |
- LICENSE | |
pull_request: | |
paths-ignore: # ignore files that don't change build output | |
- '**/*.md' | |
- .github/dependabot.yml | |
- .gitignore | |
- LICENSE | |
jobs: | |
python: | |
runs-on: "${{ vars.RUNS_ON || 'ubuntu-22.04' }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.11"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install depends for profiler | |
run: | | |
sudo apt update | |
sudo apt install ethtool iw tcpdump wpasupplicant | |
python -m ensurepip --upgrade | |
python -m pip install --upgrade pip setuptools wheel | |
pip install tox coverage-badge | |
if [ -f requirements.txt ]; then sudo pip install -r requirements.txt; fi | |
- name: Run format checker | |
id: format-checker | |
run: | | |
tox -e formatcheck | |
slack-workflow-status: | |
if: ${{ always() && (github.repository_owner == 'WLAN-Pi') && (! github.event.pull_request.head.repo.fork) }} | |
name: Post Workflow Status to Slack | |
needs: | |
- python | |
runs-on: 'ubuntu-22.04' | |
steps: | |
- name: Slack Workflow Notification | |
uses: Gamesight/slack-workflow-status@master | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} |