-
-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (78 loc) · 2.97 KB
/
pull-request-check.yml
File metadata and controls
99 lines (78 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Pull Request Check
on: [pull_request]
jobs:
format:
# Check if the PR is not from a fork
name: Format and Lint Code
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Show files
run: ls -la
- name: Run ruff linter with auto-fix
run: ruff check --exit-zero --fix .
- name: Run ruff formatter
run: ruff format .
- name: Check for modified files
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Ruff Formatter'
git config --global user.email 'ruff_formatter@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.YO_JENKINS_YAPF }}@github.com/${{ github.repository }}
git commit -am "Ruff formatting and linting automated changes"
git push
install_run:
name: Install and Run
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest] # , windows-latest]
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- 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@v5
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: Install ruff on MacOS
if: matrix.os == 'macos-latest'
run: pipenv run pip install ruff
- 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