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

Refactor Step 1 #97

Closed
wants to merge 14 commits into from
Closed
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
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: XMLTV-Import

on:
push:
branches: [ python3 ]
pull_request:
branches:
- "*"

jobs:
build:
name: Build XMLTV-Import
runs-on: ubuntu-22.04
strategy:
matrix:
python: ['3.10','3.11','3.12','3.13']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Build XMLTV-Import, python ${{ matrix.python }}
run: |
python -m compileall .
28 changes: 28 additions & 0 deletions .github/workflows/buildbot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: buildbot

on:
push:
branches: [ python3 ]

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04

steps:

- uses: actions/checkout@v3
with:
ref: 'python3'

- uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Build python CI
run: |
sudo apt-get -q update
sudo apt-get install dos2unix
pip install --upgrade pip autopep8
./CI/build.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.pyc
*.mo
74 changes: 74 additions & 0 deletions CI/PEP8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/sh

echo ""
echo "PEP8 double aggressive safe cleanup by Persian Prince"
# Script by Persian Prince for https://github.com/OpenVisionE2
# You're not allowed to remove my copyright or reuse this script without putting this header.
echo ""
echo "Changing py files, please wait ..."
begin=$(date +"%s")

echo ""
echo "PEP8 double aggressive E401"
autopep8 . -a -a -j 0 --recursive --select=E401 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive E401"

echo ""
echo "PEP8 double aggressive E701, E70 and E502"
autopep8 . -a -a -j 0 --recursive --select=E701,E70,E502 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive E701, E70 and E502"

echo ""
echo "PEP8 double aggressive E251 and E252"
autopep8 . -a -a -j 0 --recursive --select=E251,E252 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive E251 and E252"

echo ""
echo "PEP8 double aggressive E20 and E211"
autopep8 . -a -a -j 0 --recursive --select=E20,E211 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive E20 and E211"

echo ""
echo "PEP8 double aggressive E22, E224, E241, E242 and E27"
autopep8 . -a -a -j 0 --recursive --select=E22,E224,E241,E242,E27 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive E22, E224, E241, E242 and E27"

echo ""
echo "PEP8 double aggressive E225 ~ E228 and E231 and E261"
autopep8 . -a -a -j 0 --recursive --select=E225,E226,E227,E228,E231,E261 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive E225 ~ E228 and E231"

echo ""
echo "PEP8 double aggressive E301 ~ E306"
autopep8 . -a -a -j 0 --recursive --select=E301,E302,E303,E304,E305,E306 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive E301 ~ E306"

echo ""
echo "PEP8 double aggressive W291 ~ W293 and W391"
autopep8 . -a -a -j 0 --recursive --select=W291,W292,W293,W391 --in-place
git add -u
git add *
git commit -m "PEP8 double aggressive W291 ~ W293 and W391"

echo ""
finish=$(date +"%s")
timediff=$(($finish-$begin))
echo -e "Change time was $(($timediff / 60)) minutes and $(($timediff % 60)) seconds."
echo -e "Fast changing would be less than 1 minute."
echo ""
echo "PEP8 Done!"
echo ""
29 changes: 29 additions & 0 deletions CI/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

# Script by Persian Prince for https://github.com/OpenVisionE2
# You're not allowed to remove my copyright or reuse this script without putting this header.

setup_git() {
git config --global user.email "[email protected]"
git config --global user.name "XMLTV-Import python bot"
}

commit_files() {
git clean -fd
rm -rf *.pyc
rm -rf *.pyo
rm -rf *.mo
git checkout python3
./CI/chmod.sh
./CI/dos2unix.sh
./CI/PEP8.sh
}

upload_files() {
git remote add upstream https://${GITHUB_TOKEN}@github.com/oe-alliance/XMLTV-Import.git > /dev/null 2>&1
git push --quiet upstream python3 || echo "failed to push with error $?"
}

setup_git
commit_files
upload_files
27 changes: 27 additions & 0 deletions CI/chmod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

echo ""
echo "chmod safe cleanup by Persian Prince"
# Script by Persian Prince for https://github.com/OpenVisionE2
# You're not allowed to remove my copyright or reuse this script without putting this header.
echo ""
echo "Changing py files, please wait ..."
begin=$(date +"%s")

echo ""
echo "chmod files"
find . -type d -print0 | xargs -0 chmod 0755
find . -type f -print0 | xargs -0 chmod 0644
find . -type f -name "*.sh" -exec chmod +x {} \;
git add -u
git add *
git commit -m "chmod files"

echo ""
finish=$(date +"%s")
timediff=$(($finish-$begin))
echo -e "Change time was $(($timediff / 60)) minutes and $(($timediff % 60)) seconds."
echo -e "Fast changing would be less than 1 minute."
echo ""
echo "chmod Done!"
echo ""
25 changes: 25 additions & 0 deletions CI/dos2unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

echo ""
echo "dos2unix safe cleanup by Persian Prince"
# Script by Persian Prince for https://github.com/OpenVisionE2
# You're not allowed to remove my copyright or reuse this script without putting this header.
echo ""
echo "Changing py files, please wait ..."
begin=$(date +"%s")

echo ""
echo "dos2unix files"
find . -type f \( -iname \*.bb -o -iname \*.conf -o -iname \*.c -o -iname \*.h -o -iname \*.po -o -iname \*.am -o -iname \*.inc -o -iname \*.py -o -iname \*.xml -o -iname \*.sh -o -iname \*.bbappend -o -iname \*.md \) -exec dos2unix {} +
git add -u
git add *
git commit -m "dos2unix files"

echo ""
finish=$(date +"%s")
timediff=$(($finish-$begin))
echo -e "Change time was $(($timediff / 60)) minutes and $(($timediff % 60)) seconds."
echo -e "Fast changing would be less than 1 minute."
echo ""
echo "dos2unix Done!"
echo ""
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
XMTV-Import
===========

Import's EPG data from rytec xml data sources.
Import's EPG data from rytec xml data sources.


## Build status

[![build](https://github.com/oe-alliance/XMLTV-Import/actions/workflows/build.yml/badge.svg)](https://github.com/oe-alliance/XMLTV-Import/actions/workflows/build.yml.yml)

## SonarCloud status
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=oe-alliance_XMLTV-Import&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=oe-alliance_XMLTV-Import)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=oe-alliance_XMLTV-Import&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=oe-alliance_XMLTV-Import)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=oe-alliance_XMLTV-Import&metric=bugs)](https://sonarcloud.io/summary/new_code?id=oe-alliance_XMLTV-Import)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=oe-alliance_XMLTV-Import&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=oe-alliance_XMLTV-Import)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=oe-alliance_XMLTV-Import&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=oe-alliance_XMLTV-Import)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=oe-alliance_XMLTV-Import&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=oe-alliance_XMLTV-Import)
Loading
Loading