Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Open issue when dependency prereleases fail #899

Merged
merged 5 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/prerelease-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Prerelease CI failed
assignees: choldgraf
labels: bug, enhancement
---

A prerelease of one of our dependencies failed. See the
[action log](https://github.com/{{ env.GITHUB_ACTION_REPOSITORY }}/actions/runs/{{ env.GITHUB_RUN_ID }})
for more details.
65 changes: 65 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: cron-integration

on:
schedule:
# Run this workflow once a week
jarrodmillman marked this conversation as resolved.
Show resolved Hide resolved
# ref: https://crontab.guru/#0_0_*_*_0
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
prerelease:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "pyproject.toml"

- name: Install (prerelease) dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade --pre -e .[test]

- name: Build docs to store
run: |
sphinx-build -b html docs/ docs/_build/html --keep-going -w warnings.txt

- name: Check that there are no unexpected Sphinx warnings
if: matrix.python-version == 3.9
shell: python
run: |
from pathlib import Path
import os

text = Path("./warnings.txt").read_text().strip()
print("\n=== Sphinx Warnings ===\n\n" + text) # Print just for reference so we can look at the logs
unexpected = [ii for ii in text.split("\n") if all(i not in ii for i in ["kitchen-sink", "_static", "parse.py"])]
print("\n=== Unexpected Warnings ===\n\n" + "\n".join(unexpected))

env_file = os.getenv('GITHUB_ENV')
with open(env_file, "a") as f:
f.write("SPHINX_BUILD_UNEXPECTED_WARNINGS = len(unexpected)!=0")

- name: Run the tests
run: |
pytest --color=yes
echo "PYTEST_ERRORS=$?" >> $GITHUB_ENV

# If either the docs build or the tests resulted in an error, create an issue to note it
- name: Create an issue if failure
uses: JasonEtco/create-an-issue@v2
if: ${{ env.SPHINX_BUILD_UNEXPECTED_WARNINGS || !env.PYTEST_ERRORS }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/prerelease-template.md