Skip to content

Commit

Permalink
CI: Check for uncommitted table alteration
Browse files Browse the repository at this point in the history
Before, the checks would always indicate a failure, although
the scenarios are not intended to succeed. Now, they will only
fail on an unchanged `table.md` despite a different outcome in
the scenario run.

Co-authored-by: Anderson Bravalheri <320755+abravalheri@users.noreply.github.com>
  • Loading branch information
chrysle and abravalheri committed Apr 19, 2024
1 parent d6a93a1 commit 8333e87
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 28 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI
on:
push:
branches: ["master", "src-layout"]
pull_request:
branches: ["master", "src-layout"]

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'
cat '.python-versions-used'
echo 'EOF'
} >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSIONS}}
- 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
cat report.json
python report_to_table.py
- name: Verify table has not been altered
run: |
DIFF_FOR_TABLE=$(git diff table.md)
echo "::set-output name=DIFF_FOR_TABLE::$DIFF_FOR_TABLE"
id: verify-table
- name: Fail the job
if: ${{ steps.verify-table.outputs.DIFF_FOR_TABLE != '' }}
run: |
echo "::error::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

0 comments on commit 8333e87

Please sign in to comment.