Python Tests for Josepy #1337
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: Python Tests for Josepy | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
schedule: | |
# Run at 4pm UTC or 9am PST | |
- cron: "0 16 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
TOXENV: mypy | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
# Look to see if there is a cache hit for the corresponding lock file | |
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
${{ runner.os }}- | |
- name: Install Poetry & Tox | |
run: pip install poetry>1.0.0 tox>3.3.0 | |
- name: Run tox | |
run: tox | |
# This job runs our tests like external parties such as packagers. | |
external: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install josepy + pytest | |
run: pip install .[docs] pytest | |
- name: Run tests | |
run: pytest tests | |
notify: | |
# Only notify about failed builds, do not notify about failed builds for | |
# PRs, and only notify about failed pushes to master. | |
if: ${{ failure() && github.event_name != 'pull_request' && (github.event_name != 'push' || github.ref == 'refs/heads/master') }} | |
needs: [build, external] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Write Mattermost Message | |
run: | | |
WORKFLOW_RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | |
echo "{\"text\":\"** :warning: $GITHUB_REPOSITORY: Build failed :warning: ** | [(see details)]($WORKFLOW_RUN_URL) \"}" > mattermost.json | |
- uses: mattermost/action-mattermost-notify@master | |
env: | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} |