forked from rochacbruno/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (58 loc) · 2.04 KB
/
main.yml
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
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
check-files:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check files
run: |
# Define the list of filenames you want to check
FILES_TO_CHECK=("LICENSE" "README.md" "requirements.txt" "requirements-dev.txt" "NOTICE.txt" "setup.py")
# Initialize a variable to track missing files
MISSING_FILES=()
# Check if each file exists in the root directory
for FILE in "${FILES_TO_CHECK[@]}"; do
if [ ! -f "$FILE" ]; then
MISSING_FILES+=("$FILE")
fi
done
# Output the missing files
if [ ${#MISSING_FILES[@]} -eq 0 ]; then
echo "All files exist."
else
echo "The following files are missing:"
for MISSING_FILE in "${MISSING_FILES[@]}"; do
echo "- $MISSING_FILE"
done
echo "::error::One or more files are missing."
exit 1
fi
linter:
runs-on: ubuntu-latest
needs: check-files
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: Analysing the code with pylint
run: |
pylint --disable=trailing-whitespace,missing-class-docstring,missing-final-newline,trailing-newlines \
--fail-under=9.0 \
$(git ls-files '*.py') || echo "::warning::Pylint check failed, but the workflow will continue."