chore: move python code to /scripts

This commit is contained in:
NateScarlet 2022-12-09 16:52:02 +08:00
parent df637aa453
commit ef9f9cd5e3
No known key found for this signature in database
GPG Key ID: 5C242793B070309C
11 changed files with 17 additions and 10 deletions

View File

@ -16,7 +16,7 @@ jobs:
with: with:
python-version: '3.8' python-version: '3.8'
- name: Install dependencies - name: Install dependencies
run: pip install -r requirements.txt -r dev-requirements.txt run: pip install -r dev-requirements.txt
- name: Setup git user - name: Setup git user
run: | run: |
git config user.name "GitHub Actions" git config user.name "GitHub Actions"
@ -29,10 +29,10 @@ jobs:
if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }} if: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}
env: env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: coverage run -a ./update.py --release run: coverage run -a ./scripts/update.py --release
- name: Update - name: Update
if: ${{ !(github.ref == 'refs/heads/master' && github.event_name != 'pull_request') }} if: ${{ !(github.ref == 'refs/heads/master' && github.event_name != 'pull_request') }}
run: coverage run -a ./update.py run: coverage run -a ./scripts/update.py
# FIXME # FIXME
#- name: Report coverage #- name: Report coverage
# env: # env:

View File

@ -13,3 +13,7 @@ lint:
format: format:
$(PYTHON) -m black -t py38 . $(PYTHON) -m black -t py38 .
.PHONY: test
test:
$(PYTHON) -m pytest

View File

@ -1,3 +1,10 @@
# main
requests==2.28.1
beautifulsoup4==4.11.1
tqdm==4.64.1
icalendar==4.1.0
# test
pytest==7.2.0 pytest==7.2.0
coverage==6.5.0 coverage==6.5.0
black==22.10.0 black==22.10.0

View File

@ -1,4 +0,0 @@
requests==2.28.1
beautifulsoup4==4.11.1
tqdm==4.64.1
icalendar==4.1.0

0
fetch_holidays.py → scripts/fetch.py Executable file → Normal file
View File

View File

@ -3,7 +3,7 @@ import json
import pytest import pytest
from fetch_holidays import ( from fetch import (
CustomJSONEncoder, CustomJSONEncoder,
DescriptionParser, DescriptionParser,
get_paper, get_paper,
@ -11,7 +11,7 @@ from fetch_holidays import (
get_rules, get_rules,
) )
from .filetools import _file_path from filetools import _file_path
def test_get_paper_urls(): def test_get_paper_urls():

2
update.py → scripts/update.py Executable file → Normal file
View File

@ -13,7 +13,7 @@ from zipfile import ZipFile
from tqdm import tqdm from tqdm import tqdm
from fetch_holidays import CustomJSONEncoder, fetch_holiday from fetch import CustomJSONEncoder, fetch_holiday
from generate_ics import generate_ics from generate_ics import generate_ics

View File