-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (103 loc) · 2.69 KB
/
test.yml
File metadata and controls
113 lines (103 loc) · 2.69 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
100
101
102
103
104
105
106
107
108
109
110
111
112
# Workflow on push & pull request
# * Check with flake8
# * Run tests with different python versions
#
name: Test
on:
push:
branches:
- main
paths-ignore:
- ".github/**"
- ".gitignore"
- ".readthedocs.yaml"
- "docs/**"
- "*.rst"
pull_request:
branches:
- main
paths-ignore:
- ".github/**"
- ".gitignore"
- ".readthedocs.yaml"
- "docs/**"
- "*.rst"
workflow_dispatch: {}
jobs:
check:
name: Flake8 Sanity Check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install flake8
run: |
# Install flake8
pip install flake8
- 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.
flake8 . --count --exit-zero --statistics
build_and_test:
name: Run Unit Tests
environment: test
needs:
- check
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
max-parallel: 1
steps:
- name: Checkout Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install Python packages
run: |
# There seems to be no easy way to install dependencies
# from pyproject.toml, so we just install the package...
pip install -e .[test]
- name: Prepare test configuration
run: |
# Generate test configuration
cat >tests/.test-config.yaml <<EOF
auth:
desktop:
api_key: "${{ secrets.API_KEY }}"
api_secret: "${{ secrets.API_SECRET }}"
web:
api_key: "${{ secrets.WEB_API_KEY }}"
api_secret: "${{ secrets.WEB_API_SECRET }}"
user:
user_id: "${{ secrets.USER_ID }}"
username: "${{ secrets.USERNAME }}"
cookies:
www.ipernity.com:
/:
cookie_consent: ok
s: ${{ secrets.COOKIE_S }}
ua: ${{ secrets.COOKIE_UA }}
EOF
- name: Test with Pytest
run: |
# Run Python test
pytest