-
Notifications
You must be signed in to change notification settings - Fork 3.4k
185 lines (178 loc) · 7.41 KB
/
Copy pathtests.yml
File metadata and controls
185 lines (178 loc) · 7.41 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: tests
on:
push:
branches: [master]
tags: ['*']
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
permissions:
contents: read
jobs:
flake8-mandatory:
name: "linter: Flake8 Mandatory"
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
cache: 'pip'
- name: Install flake8
run: pip install "flake8==7.3.0" "flake8-bugbear==25.10.21"
- name: Run flake8
# list of error codes:
# - https://flake8.pycqa.org/en/latest/user/error-codes.html
# - https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
# - https://github.com/PyCQA/flake8-bugbear/tree/8c0e7eb04217494d48d0ab093bf5b31db0921989#list-of-warnings
run: |
flake8 . --count \
--select="E9,E101,E129,E273,E274,E703,E71,E722,F5,F6,F7,F8,W191,W29,B,B909" \
--ignore="B007,B009,B010,B036,B042,F541,F841" \
--show-source --statistics \
--exclude "*_pb2.py,electrum/_vendor/"
ban-unicode:
name: "linter: ban unicode"
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
- name: Run ban_unicode
run: ./contrib/ban_unicode.py
# unittests using the 'latest' runtime python-dependencies
unittests:
name: "unittests: py${{ matrix.python }}${{ matrix.debug && ', debug-mode' || '' }}"
runs-on: ubuntu-24.04
needs: [flake8-mandatory]
strategy:
fail-fast: false
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
debug: [false]
include:
- python: "3.14"
debug: true
env:
LD_LIBRARY_PATH: contrib/_saved_secp256k1_build/
PYTHONASYNCIODEBUG: ${{ matrix.debug && '1' || '' }}
PYTHONDEVMODE: ${{ matrix.debug && '1' || '' }}
ELECTRUM_ECC_DONT_COMPILE: "1"
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # full clone for coveralls
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: |
contrib/requirements/requirements-ci.txt
contrib/requirements/requirements.txt
- name: Cache libsecp256k1
id: cache-libsecp
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: contrib/_saved_secp256k1_build
key: libsecp-${{ runner.os }}-${{ hashFiles('contrib/make_libsecp256k1.sh') }}
- name: Build libsecp256k1
if: steps.cache-libsecp.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get -y install automake libtool
./contrib/make_libsecp256k1.sh
mkdir -p contrib/_saved_secp256k1_build
cp electrum/libsecp256k1.so.* contrib/_saved_secp256k1_build/
- name: Install Qt/QML runtime deps
run: |
sudo apt-get update
sudo apt-get -y install libgl1 libegl1 libxkbcommon0 libdbus-1-3 libleveldb-dev
- name: Install Python dependencies
run: |
pip install -r contrib/requirements/requirements-ci.txt
pip install ".[tests,qml_gui]"
- name: Log versions
run: python3 --version && pip freeze --all
- name: Run pytest with coverage
run: |
coverage run --source=electrum \
"--omit=electrum/gui/*,electrum/plugins/*,electrum/scripts/*" \
-m pytest tests -v
coverage report
- name: Upload to Coveralls
if: matrix.python == '3.10' && !matrix.debug
env:
# 'COVERALLS_REPO_TOKEN' needs to be set in the GitHub repository settings
# This is a "repo token", NOT a "Personal API Token"!
# ref https://coveralls.io/github/spesmilo/electrum/settings
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
CI_NAME: github-actions
CI_BUILD_NUMBER: ${{ github.run_id }}
CI_JOB_ID: ${{ github.job }}-${{ github.run_attempt }}
CI_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
CI_BRANCH: ${{ github.ref_name }}
CI_PULL_REQUEST: ${{ github.event.pull_request.number }}
# the repo token will be empty when pull requests from forks get opened
# so we won't upload on every pull request, but it will run again
# with the token once the PR gets merged.
run: if [ -n "$COVERALLS_REPO_TOKEN" ]; then coveralls; else echo "missing COVERALLS_REPO_TOKEN"; fi
# unittests using the ~same frozen dependencies that are used in the released binaries
# note: not using pinned pyqt here, due to "qml_gui" extra
unittests-frozen:
name: "unittests: py3.10, frozen-deps"
runs-on: ubuntu-24.04
needs: [flake8-mandatory]
env:
LD_LIBRARY_PATH: contrib/_saved_secp256k1_build/
ELECTRUM_ECC_DONT_COMPILE: "1"
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
cache: 'pip'
cache-dependency-path: |
contrib/requirements/requirements-ci.txt
contrib/requirements/requirements.txt
contrib/deterministic-build/requirements.txt
contrib/deterministic-build/requirements-binaries.txt
contrib/deterministic-build/requirements-build-base.txt
- name: Cache libsecp256k1
id: cache-libsecp
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: contrib/_saved_secp256k1_build
key: libsecp-${{ runner.os }}-${{ hashFiles('contrib/make_libsecp256k1.sh') }}
- name: Build libsecp256k1
if: steps.cache-libsecp.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get -y install automake libtool
./contrib/make_libsecp256k1.sh
mkdir -p contrib/_saved_secp256k1_build
cp electrum/libsecp256k1.so.* contrib/_saved_secp256k1_build/
- name: Install Qt/QML runtime deps
run: |
sudo apt-get update
sudo apt-get -y install libgl1 libegl1 libxkbcommon0 libdbus-1-3
- name: Install Python dependencies (frozen)
run: |
pip install -r contrib/deterministic-build/requirements-build-base.txt
pip install -r contrib/requirements/requirements-ci.txt
pip install -r contrib/deterministic-build/requirements.txt -r contrib/deterministic-build/requirements-binaries.txt
pip install ".[tests,qml_gui]"
- name: Log versions
run: python3 --version && pip freeze --all
- name: Run pytest
run: pytest tests -v