Skip to content

Commit

Permalink
Fixing GitHub Actions (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
ismet55555 committed Jul 4, 2023
1 parent 2b73de2 commit 4d7f6a7
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 210 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/pull-request-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Pull Request Check
on: [pull_request]
jobs:
format:
# Check if the PR is not from a fork
name: Format Code
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: yapf setup
run: |
python -m pip install --upgrade pip
pip install yapf
pip install toml
- name: Show files
run: ls -la

- name: yapf run
run: yapf --in-place --recursive --verbose .

- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)

- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'YAPF Checker'
git config --global user.email 'YAPF_CHECKER@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.YO_JENKINS_YAPF }}@github.com/${{ github.repository }}
git commit -am "YAPF formatting check automated changes"
git push
install_run:
name: Install and Run
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest] # ! FIXME: Add windows
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Update apt package repositories
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update

- name: Install Linux simpleaudio dependency
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y python3-dev libasound2-dev

- name: Install/Upgrade Python tooling
run: python -m pip install --upgrade pip pipenv virtualenv wheel setuptools

- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies if not in cache
run: pipenv install --ignore-pipfile --dev

- name: Stupid hack for installing pylint on MacOS
if: matrix.os == 'macos-latest'
run: pipenv run pip install pylint

# - name: Show all dependencies (pipenv)
# run: pipenv graph --bare

- name: Show all dependencies (pip)
run: pipenv run pip list

- name: Pre-commit run
run: pipenv run pre-commit run --all-files

- name: Build the package
run: pipenv run python setup.py install --verbose

- name: Testing --help
run: pipenv run yojenkins --help
56 changes: 38 additions & 18 deletions .github/workflows/test-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest] #, windows-latest] # ! FIXME: Add windows
python-version: [3.10] # ! FIXME: Add 3.7
python-version: ['3.10'] # ! FIXME: Add 3.7

steps:
- uses: actions/checkout@v3
Expand All @@ -48,22 +48,28 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y python3-dev libasound2-dev

- name: Install pipenv
run: |
python -m pip install --upgrade-strategy=only-if-needed pip pipenv
- name: Install/Upgrade Python tooling
run: python -m pip install --upgrade pip pipenv virtualenv wheel setuptools

- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-V3-${{ hashFiles('**/Pipfile.lock') }}
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies if not in cache
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: pipenv sync --dev

- name: Show All dependencies
run: pipenv graph
- name: Stupid hack for installing pylint on MacOS
if: matrix.os == 'macos-latest'
run: pipenv run pip install pylint

# - name: Show all dependencies (pipenv)
# run: pipenv graph --bare

- name: Show all dependencies (pip)
run: pipenv run pip list

- name: Code Linting
run: pipenv run pylint ./yojenkins --rcfile=.pylintrc
Expand Down Expand Up @@ -97,24 +103,31 @@ jobs:
- name: Install Linux simpleaudio dependency
run: sudo apt-get install -y python3-dev libasound2-dev

- name: Install pipenv
run: python -m pip install --upgrade-strategy=only-if-needed pip pipenv
- name: Install/Upgrade Python tooling
run: python -m pip install --upgrade pip pipenv virtualenv wheel setuptools

- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-V3-${{ hashFiles('**/Pipfile.lock') }}
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies if not in cache
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: pipenv sync --dev

- name: Stupid hack for installing pylint on MacOS
if: matrix.os == 'macos-latest'
run: pipenv run pip install pylint

- name: Install pypa/build tooling
run: pipenv run python -m pip install build

- name: Show all installed pip packages
run: pipenv graph
# - name: Show all dependencies (pipenv)
# run: pipenv graph --bare

- name: Show all dependencies (pip)
run: pipenv run pip list

- name: Create release version tag
id: release
Expand Down Expand Up @@ -158,21 +171,28 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y python3-dev libasound2-dev

- name: Install pipenv
run: python -m pip install --upgrade-strategy=only-if-needed pip pipenv
- name: Install/Upgrade Python tooling
run: python -m pip install --upgrade pip pipenv virtualenv wheel setuptools

- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-V3-${{ hashFiles('**/Pipfile.lock') }}
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies if not in cache
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: pipenv sync --de
run: pipenv sync --dev

- name: Stupid hack for installing pylint on MacOS
if: matrix.os == 'macos-latest'
run: pipenv run pip install pylint

# - name: Show all dependencies (pipenv)
# run: pipenv graph --bare

- name: Show all installed pip packages
run: pipenv graph
- name: Show all dependencies (pip)
run: pipenv run pip list

- name: Build with PyInstaller
env:
Expand Down
61 changes: 0 additions & 61 deletions .github/workflows/test-simple-run.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/yapf-check.yml

This file was deleted.

9 changes: 2 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ repos:
hooks:
- id: gitleaks

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.29.0
hooks:
- id: yamllint
args: [--strict, -c=.yamllint]

- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.31.0
hooks:
Expand Down Expand Up @@ -83,5 +77,6 @@ repos:
"--rcfile=.pylintrc", # Link to your config file
"--load-plugins=pylint.extensions.docparams", # Load an extension
"--output-format=colorized", # Load an extension
"--fail-under=8.0"
"--fail-under=8.0",
# "--disable=R0913,W0511,R0912,W1309", # Disable some specific messages IDs
]

0 comments on commit 4d7f6a7

Please sign in to comment.