Skip to content
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
116 changes: 58 additions & 58 deletions .github/workflows/black-format.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Automatically format with Black and submit PR

on:
push:
branches:
- master
push:
branches:
- master

workflow_dispatch:
workflow_dispatch:

jobs:
format:
Expand All @@ -14,57 +14,57 @@ jobs:
contents: write
pull-requests: write
steps:
- name: Checks-out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install black
run: |
python -m pip install --upgrade pip
python -m pip install black
- name: Reformat with black
run: |
shopt -s globstar
black cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py > black_output.txt 2>&1
- name: Check if there are changes
run: |
git diff --exit-code || touch git_diff_exists
if [ -f git_diff_exists ]; then echo "Changes need to be commited"; else echo "No changes to commit"; fi
- name: Create commit message
if: hashFiles('git_diff_exists') != ''
run: |
echo "Reformatted python code using Black formatter" >> commit_message.txt
echo "" >> commit_message.txt
echo "Output from black:" >> commit_message.txt
echo "" >> commit_message.txt
echo '```' >> commit_message.txt
cat black_output.txt >> commit_message.txt
echo '```' >> commit_message.txt
- name: Commit changes
if: hashFiles('git_diff_exists') != ''
run: |
git config user.name 'GitHub'
git config user.email '<noreply@github.com>'
shopt -s globstar
git add cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py
git commit -F commit_message.txt
- id: commit-message-from-file
name: Parse commit message from file into variable
if: hashFiles('git_diff_exists') != ''
run: |
body=$(cat commit_message.txt)
body="${body//$'\n'/'%0A'}"
echo ::set-output name=body::$body
- name: Create Pull Request
if: hashFiles('git_diff_exists') != ''
uses: cfengine/create-pull-request@v6
with:
title: Reformatted python code using Black formatter
body: ${{ steps.commit-message-from-file.outputs.body }}
reviewers: |
olehermanse
larsewi
vpodzime
branch: formatting-action
- name: Checks-out repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install black
run: |
python -m pip install --upgrade pip
python -m pip install black
- name: Reformat with black
run: |
shopt -s globstar
black cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py > black_output.txt 2>&1
- name: Check if there are changes
run: |
git diff --exit-code || touch git_diff_exists
if [ -f git_diff_exists ]; then echo "Changes need to be commited"; else echo "No changes to commit"; fi
- name: Create commit message
if: hashFiles('git_diff_exists') != ''
run: |
echo "Reformatted python code using Black formatter" >> commit_message.txt
echo "" >> commit_message.txt
echo "Output from black:" >> commit_message.txt
echo "" >> commit_message.txt
echo '```' >> commit_message.txt
cat black_output.txt >> commit_message.txt
echo '```' >> commit_message.txt
- name: Commit changes
if: hashFiles('git_diff_exists') != ''
run: |
git config user.name 'GitHub'
git config user.email '<noreply@github.com>'
shopt -s globstar
git add cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py
git commit -F commit_message.txt
- id: commit-message-from-file
name: Parse commit message from file into variable
if: hashFiles('git_diff_exists') != ''
run: |
body=$(cat commit_message.txt)
body="${body//$'\n'/'%0A'}"
echo ::set-output name=body::$body
- name: Create Pull Request
if: hashFiles('git_diff_exists') != ''
uses: cfengine/create-pull-request@v6
with:
title: Reformatted python code using Black formatter
body: ${{ steps.commit-message-from-file.outputs.body }}
reviewers: |
olehermanse
larsewi
vpodzime
branch: formatting-action
32 changes: 16 additions & 16 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Black

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
check:
Expand All @@ -18,17 +18,17 @@ jobs:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check formatting with black
run: |
shopt -s globstar
black --check cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Check formatting with black
run: |
shopt -s globstar
black --check cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py
33 changes: 16 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,22 @@ on:

jobs:
deploy:

runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
109 changes: 56 additions & 53 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Python tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test:
Expand All @@ -18,34 +18,37 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest setuptools wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cfbs-*.whl
- name: Run bash tests
run: |
UNSAFE_TESTS=1 bash tests/shell/all.sh
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pyright pyflakes pytest setuptools wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160
- name: Lint with pyright (type checking)
run: |
pyright cfbs
- name: Lint with pyflakes
run: |
pyflakes cfbs
- name: Test with pytest
run: |
pytest
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cfbs-*.whl
- name: Run bash tests
run: |
UNSAFE_TESTS=1 bash tests/shell/all.sh
test-legacy:
runs-on: ubuntu-24.04
env:
Expand All @@ -57,26 +60,26 @@ jobs:
python-version: ["3.5.10", "3.6.15", "3.7.10"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up legacy Python ${{ matrix.python-version }}
uses: ./.github/actions/set-up-legacy-python
with:
python-version: ${{ matrix.python-version }}
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cfbs-*.whl
- name: Run bash tests
run: |
UNSAFE_TESTS=1 bash tests/shell/all.sh
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up legacy Python ${{ matrix.python-version }}
uses: ./.github/actions/set-up-legacy-python
with:
python-version: ${{ matrix.python-version }}
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cfbs-*.whl
- name: Run bash tests
run: |
UNSAFE_TESTS=1 bash tests/shell/all.sh
32 changes: 16 additions & 16 deletions .github/workflows/python-validate-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Python validate test

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
test-legacy:
Expand All @@ -21,17 +21,17 @@ jobs:
python-version: ["3.5.10"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up legacy Python ${{ matrix.python-version }}
uses: ./.github/actions/set-up-legacy-python
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cfbs-*.whl
- name: Run bash tests
run: |
bash tests/shell/validate.sh
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up legacy Python ${{ matrix.python-version }}
uses: ./.github/actions/set-up-legacy-python
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cfbs-*.whl
- name: Run bash tests
run: |
bash tests/shell/validate.sh
Loading