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

CI: Check for uncommitted table alteration #27

Merged
merged 8 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI
on:
push:
branches: ["master", "src-layout"]
pull_request:
branches: ["master", "src-layout"]
schedule:
- cron: "0 12 1 * *"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
generate-compatibility-matrix:
name: >-
Check for any uncommitted
table alteration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Determine Python versions
run: |
{
echo 'PYTHON_VERSIONS<<EOF'
webknjaz marked this conversation as resolved.
Show resolved Hide resolved
cat '.python-versions-used'
echo 'EOF'
} >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSIONS}}
webknjaz marked this conversation as resolved.
Show resolved Hide resolved
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Generate compatibility matrix with nox
continue-on-error: true
run: |
python -m nox --report report.json
- name: Verify table has not been altered
run: |
cat report.json
chrysle marked this conversation as resolved.
Show resolved Hide resolved
python report_to_table.py
git diff table.md
DIFF_FOR_TABLE=$(git diff table.md)
echo "DIFF_FOR_TABLE=$DIFF_FOR_TABLE" >> $GITHUB_OUTPUT
webknjaz marked this conversation as resolved.
Show resolved Hide resolved
id: verify-table
- name: Fail the job
chrysle marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ steps.verify-table.outputs.DIFF_FOR_TABLE != '' }}
chrysle marked this conversation as resolved.
Show resolved Hide resolved
run: |
echo "::error file=table.md::Table has been altered but not committed!"
exit 1
26 changes: 0 additions & 26 deletions .github/workflows/nox.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .python-versions-used
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3.8
3.10
3.12
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

# -- REQUIRES: nox >= 2023.04.22
# SEE: https://nox.thea.codes/en/stable/index.html
USE_PYTHON_VERSIONS_DEFAULT = ["3.8", "3.10", "3.12"]
USE_PYTHON_VERSIONS = os.environ.get("NOXFILE_PYTHON_VERSIONS", "").split()
if not USE_PYTHON_VERSIONS:
USE_PYTHON_VERSIONS = USE_PYTHON_VERSIONS_DEFAULT
with open(os.path.join(HERE, ".python-versions-used"), "r") as file:
USE_PYTHON_VERSIONS = [x.strip() for x in file]


install_commands = (("pip", "install", "."), ("pip", "install", "-e", "."))
Expand Down
Loading