mirror of
https://github.com/senju1337/senju.git
synced 2025-12-24 07:39:29 +00:00
Merge pull request #8 from senju1337/feat/setup-formatter-ci
ci for formatter
This commit is contained in:
commit
e0f70a3106
5 changed files with 53 additions and 17 deletions
43
.github/workflows/formatter.yml
vendored
Normal file
43
.github/workflows/formatter.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
name: Format
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
format:
|
||||
permissions:
|
||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||
# added or changed files to the repository.
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.10"]
|
||||
|
||||
steps:
|
||||
- name: Check out source repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Python environment
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: autopep8
|
||||
id: autopep8
|
||||
uses: peter-evans/autopep8@v2
|
||||
with:
|
||||
args: --recursive --in-place --aggressive --aggressive .
|
||||
- name: flake8 Lint
|
||||
uses: py-actions/flake8@v2
|
||||
|
||||
- name: commit back to repository
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
# These defaults somehow do not work for me, so I've set them
|
||||
# explicitly
|
||||
# The big number is the userid of the bot
|
||||
commit_user_name: github-actions[bot]
|
||||
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
|
||||
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> # defaults to "username <username@users.noreply.github.com>", where "username" belongs to the author of the commit that triggered the run
|
||||
commit_message: "ci: automatic Python Formatter changes"
|
||||
3
.github/workflows/tests.yml
vendored
3
.github/workflows/tests.yml
vendored
|
|
@ -4,9 +4,6 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from flask import Flask, url_for
|
||||
from markupsafe import escape
|
||||
|
||||
|
||||
def main():
|
||||
print("hello world")
|
||||
|
|
|
|||
|
|
@ -8,4 +8,3 @@ import pytest
|
|||
def temp_data_dir():
|
||||
"""Create a temporary directory for test data"""
|
||||
return Path(tempfile.mkdtemp())
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
# I do not trust python and it's tests, so I'm testing them. May not be worth much, but at least it shows me a few things.
|
||||
# I do not trust python and it's tests, so I'm testing them. May not be worth
|
||||
# much, but at least it shows me a few things.
|
||||
|
||||
import os
|
||||
import pytest # noqa: F401 do not remove this import. This is needed for pytest fixtures to work
|
||||
# do not remove this import. This is needed for
|
||||
# pytest fixtures to work
|
||||
import pytest # noqa: F401
|
||||
|
||||
import senju # noqa: F401
|
||||
|
||||
# Note: these weird arguments are an indicator of what should be dome before. For example,
|
||||
# `temp_data_dir` is a function in `conftest.py`. If we put it in the arguments, it seems
|
||||
# to run before our test, and the return value becomes a local.
|
||||
#
|
||||
# This is all very confusing for someone used to Rust's libtest
|
||||
# Note: these weird arguments are an indicator of what should be dome
|
||||
# before. For example, `temp_data_dir` is a function in `conftest.py`. If we
|
||||
# put it in the arguments, it seems to run before our test, and the return
|
||||
# value becomes a local. This is all very confusing for someone used to
|
||||
# Rust's libtest
|
||||
|
||||
|
||||
def test_tests_are_loaded():
|
||||
|
|
@ -22,4 +25,3 @@ def test_temp_data_dir(temp_data_dir):
|
|||
with open(testpath, "w") as f:
|
||||
f.write("that dir actually works")
|
||||
os.remove(testpath)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue