Skip to content

Commit

Permalink
Create python-app.yml and dependabot.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ddugovic committed Nov 19, 2024
1 parent 5525c51 commit 57e10a1
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "00:00"
timezone: America/Chicago
open-pull-requests-limit: 10
22 changes: 22 additions & 0 deletions .github/workflows/dependabot-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Dependabot auto-merge
on: pull_request

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
61 changes: 61 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: "Get pip cache dir"
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- uses: "actions/cache@v2"
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
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: |
make test
- name: Package Application
uses: Alcance-Innovation-Consulting/pyinstaller-action-windows@main
with:
path: .
spec: Lichess.spec

- uses: actions/upload-artifact@v4
with:
name: Lichess
path: dist/windows
34 changes: 34 additions & 0 deletions Lichess.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['main.py'],
pathex=['/home/lichess/Lichess'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=True,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='Lichess',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PHONY: test
test:
PYTHONPATH=. pytest
5 changes: 5 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pytest]
minversion = 6.0
addopts = -vvv --cov-config .coveragerc --cov-report term --cov=. -rx -s
testpaths =
tests
4 changes: 4 additions & 0 deletions tests/test_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from math import sqrt

def test_euclidean_distance():
assert euclidean_distance([0, 3], [4, 0]) == 5

0 comments on commit 57e10a1

Please sign in to comment.