[STYLE] Minor improvement for code style #252
This file contains hidden or 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: CI | |
on: | |
push: | |
branches: | |
- master | |
- stable | |
- patch* | |
- feature* | |
tags: | |
- v* | |
pull_request: | |
types: | |
- opened | |
- edited | |
- reopened | |
- ready_for_review | |
# Declare default permissions as read only. | |
permissions: read-all | |
jobs: | |
BUILD: | |
if: github.repository == 'reactive-firewall/python-repo' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
env: | |
LANG: "en_US.UTF-8" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Pre-Clean | |
id: clean | |
run: make -j1 -f Makefile purge 2>/dev/null || true ; | |
- name: Test Build | |
id: build | |
run: make -j1 -f Makefile build ; | |
- name: Post-Clean | |
id: post | |
run: make -j1 -f Makefile purge || true ; | |
BOOTSTRAP: | |
if: ${{ !cancelled() }} | |
needs: BUILD | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
timeout-minutes: 5 | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
lang-var: ["de.utf-8", "jp.utf-8"] | |
experimental: [true] | |
include: | |
- python-version: 3.9 | |
lang-var: "en_US.utf-8" | |
experimental: false | |
- python-version: "3.10" | |
lang-var: "en_US.utf-8" | |
experimental: false | |
- python-version: "3.11" | |
lang-var: "en_US.utf-8" | |
experimental: false | |
- python-version: "3.12" | |
lang-var: "en_US.utf-8" | |
experimental: false | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
LANG: ${{ matrix.lang-var }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup dependencies | |
run: | | |
python -m pip install --upgrade "pip>=24.3.1" "setuptools>=45.0" "wheel>=0.37" | |
pip install -r ./requirements.txt | |
pip install -r ./test-requirements.txt || true | |
- name: Pre-build | |
id: bootstrap | |
run: | | |
make -j1 -f Makefile clean || true ; | |
make -j1 -f Makefile build ; | |
shell: bash | |
- name: Summerize Building | |
id: sumerize-py-build | |
run: | | |
echo "- Building works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY | |
if: ${{ success() }} | |
shell: bash | |
- name: Run Tests | |
id: test-install | |
run: make -j1 -f Makefile user-install ; | |
shell: bash | |
- name: Summerize Install | |
id: sumerize-user-install | |
run: | | |
echo "- User Installing works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY | |
if: ${{ success() }} | |
shell: bash | |
- name: Test Info | |
id: test-info | |
run: python -m setup --name --version --license || true ; | |
- name: Post-Clean | |
id: post | |
run: | | |
make -j1 -f Makefile purge || true ; | |
make -j1 -f Makefile clean || true ; | |
if: ${{ !cancelled() }} | |
shell: bash | |
MATS: | |
if: ${{ !cancelled() }} | |
needs: BUILD | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
python-version: ["3.9.21", "3.10", "3.11", "3.12"] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
LANG: "en_US.utf-8" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies for ${{ matrix.python-version }} | |
run: | | |
pip install -r ./requirements.txt | |
pip install -r ./test-requirements.txt || true | |
- name: Pre-Clean | |
id: clean | |
run: make -j1 -f Makefile clean || true ; | |
- name: Run Tests for python ${{ matrix.python-version }} | |
id: tests | |
run: make -j1 -f Makefile test ; | |
- name: Summerize MATs for python ${{ matrix.python-version }} | |
id: sumerize-mats | |
run: | | |
echo "- MATS works on python version ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY | |
if: ${{ success() }} | |
shell: bash | |
- name: Post-Clean | |
id: post | |
run: make -j1 -f Makefile clean || true ; | |
if: ${{ !cancelled() }} | |
COVERAGE: | |
if: ${{ success() }} | |
needs: [BUILD, MATS] | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
LANG: "en_US.utf-8" | |
COVERAGE_RCFILE: ./.coveragerc | |
COV_CORE_SOURCE: ./ | |
COV_CORE_CONFIG: ./.coveragerc | |
COV_CORE_DATAFILE: ./coverage.xml\ | |
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }} | |
CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Fix braindead windows ${{ matrix.python-version }} on ${{ matrix.os }} | |
if: ${{ !cancelled() && runner.os == 'Windows' }} | |
run: python -m pip install --upgrade pip | |
- name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} | |
shell: bash | |
run: make -f Makefile test-reqs ; | |
- name: Pre-Clean | |
id: clean | |
shell: bash | |
run: make -j1 -f Makefile clean || true ; | |
- name: Install code-climate tools for ${{ matrix.python-version }} | |
if: ${{ !cancelled() && runner.os != 'Windows' }} | |
shell: bash | |
run: ./tests/fetch-test-reporter || true ; | |
- name: Generate Coverage for py3.9 on ${{ matrix.os }} | |
if: ${{ matrix.python-version == '3.9' }} | |
shell: bash | |
run: make -f Makefile test ; | |
- name: Generate Coverage for py${{ matrix.python-version }} on ${{ matrix.os }} | |
if: ${{ matrix.python-version != '3.9' }} | |
shell: bash | |
run: make -f Makefile test-pytest ; | |
- name: Upload Python ${{ matrix.python-version }} coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
directory: . | |
flags: ${{ matrix.os }},${{ matrix.python-version }} | |
name: pythonrepo-github-${{ matrix.os }}-${{ matrix.python-version }} | |
verbose: true | |
fail_ci_if_error: false | |
- name: Upload Python ${{ matrix.python-version }} Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test-Report-${{ matrix.os }}-${{ matrix.python-version }} | |
path: ./test-reports/ | |
if-no-files-found: ignore | |
- name: code-climate for ${{ matrix.python-version }} | |
if: ${{ !cancelled() && runner.os != 'Windows' }} | |
shell: bash | |
run: | | |
./cc-test-reporter after-build --exit-code 0 || true ; | |
- name: deepsource for ${{ matrix.python-version }} | |
if: ${{ !cancelled() && runner.os != 'Windows' }} | |
shell: bash | |
run: | | |
./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml 2>/dev/null || true ; | |
- name: Post-Clean | |
id: post | |
shell: bash | |
run: make -j1 -f Makefile clean || true ; | |
if: ${{ !cancelled() }} | |
STYLE: | |
if: ${{ success() }} | |
needs: [BUILD, MATS] | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
PYTHON_VERSION: '3.12' | |
LANG: "en_US.utf-8" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies for python Linters | |
shell: bash | |
run: make -f Makefile test-reqs || true ; | |
- name: Pre-Clean | |
id: clean | |
run: make -j1 -f Makefile clean || true ; | |
- name: Testing Style | |
id: style | |
run: make -j1 -f Makefile test-style ; | |
shell: bash | |
- name: Post-Clean | |
id: post | |
run: make -j1 -f Makefile clean || true ; | |
if: ${{ !cancelled() }} | |
INTEGRATION: | |
if: ${{ success() }} | |
needs: [MATS, COVERAGE] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ["3.11", "3.12"] | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
LANG: "en_US.utf-8" | |
LC_CTYPE: "en_US.utf-8" | |
COVERAGE_RCFILE: ./.coveragerc | |
COV_CORE_SOURCE: ./ | |
COV_CORE_CONFIG: ./.coveragerc | |
COV_CORE_DATAFILE: .coverage | |
CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }} | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }} | |
shell: bash | |
run: make -f Makefile test-reqs ; | |
- name: Install code-climate tools for ${{ matrix.python-version }} on ${{ matrix.os }} | |
if: ${{ !cancelled() && runner.os != 'Windows' }} | |
run: if [ $OS == macos-latest ] ; then ./tests/fetch-test-reporter || true ; fi ; | |
shell: bash | |
- name: Pre-Clean | |
id: clean-prep | |
shell: bash | |
run: make -j1 -f Makefile clean ; | |
- name: Pre-build for Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
shell: bash | |
run: make -j1 -f Makefile build ; | |
if: ${{ success() }} | |
- name: Pre-install for Python ${{ matrix.python-version }} on ${{ matrix.os }} | |
run: make -j1 -f Makefile user-install || true ; | |
if: ${{ success() }} | |
- name: Re-Generate Coverage for py${{ matrix.python-version }} on ${{ matrix.os }} | |
run: | | |
make -j1 -f Makefile test-pytest ; | |
cp -vf ./coverage.xml ./test-reports/coverage.xml || true ; | |
shell: bash | |
- name: Upload Python ${{ matrix.python-version }} coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./test-reports/coverage_supplement.xml | |
directory: . | |
flags: ${{ matrix.os }},${{ matrix.python-version }} | |
name: pythonrepo-github-${{ matrix.os }}-${{ matrix.python-version }} | |
verbose: true | |
fail_ci_if_error: false | |
- name: Upload Extra Python ${{ matrix.python-version }} Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Integration-Test-Report-${{ matrix.os }}-${{ matrix.python-version }} | |
path: ./test-reports/ | |
if-no-files-found: ignore | |
- name: code-climate for ${{ matrix.python-version }} | |
if: ${{ !cancelled() && runner.os != 'Windows' }} | |
run: | | |
./cc-test-reporter after-build --exit-code 0 || true ; | |
- name: Post-purge | |
id: post-uninstall | |
run: make -j1 -f Makefile purge || true ; | |
if: ${{ !cancelled() }} | |
- name: Post-Clean | |
id: post-z-end | |
run: make -j1 -f Makefile clean || true ; | |
if: ${{ !cancelled() }} | |
TOX: | |
if: ${{ success() }} | |
needs: [MATS, STYLE, COVERAGE, INTEGRATION] | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
PYTHON_VERSION: '3.12' | |
LANG: 'en_US.utf-8' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies for Tox | |
run: | | |
pip install --upgrade "pip>=24.3.1" "setuptools>=45.0" "wheel>=0.37" "tox>=3.0"; | |
pip install -r ./requirements.txt ; | |
pip install -r ./test-requirements.txt || true ; | |
- name: Pre-Clean | |
id: clean | |
run: make -j1 -f Makefile clean || true ; | |
- name: Testing Tox | |
run: make -j1 -f Makefile test-tox || true ; | |
- name: Post-Clean | |
id: post | |
run: make -j1 -f Makefile clean || true ; | |
if: ${{ !cancelled() }} |