forked from 3rdIteration/seedsigner
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (137 loc) · 5.12 KB
/
Copy pathtests.yml
File metadata and controls
146 lines (137 loc) · 5.12 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
name: CI
on:
push:
pull_request:
# Explicitly restrict the auto-provisioned GITHUB_TOKEN to the least privilege required
# for this workflow.
permissions:
contents: read
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
# Used by the `Version` class so it can identify the current fork
PR_AUTHOR: ${{ github.event.pull_request.user.login || github.actor }}
# Used by `Version`. We want the PR author's latest commit hash if this is a PR
# but the default SHA env var reflects a new commit into the target repo.
SOURCE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
# 3.10: currently used by Seedsigner
# 3.12: latest stable Python as upper test bound
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v6
with:
# Needs to also pull the seedsigner-translations repo
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
requirements.txt
tests/requirements.txt
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gnupg2 pinentry-curses pinentry-tty libzbar0 libpcsclite-dev pcscd swig
python -m pip install --upgrade pip
pip install -r requirements.txt -r tests/requirements.txt
# requirements-l10n.txt is hash-locked (SeedSigner OS installs it
# during image builds). It needs its own pip invocation: one hashed
# requirement makes pip demand hashes for everything else in the
# same invocation, which the unhashed files above and `-e .` below
# can't satisfy.
pip install -r l10n/requirements-l10n.txt
pip install -e .
- name: Compile translations
run: python setup.py compile_catalog
- name: Test with pytest
run: |
mkdir -p artifacts
python -m pytest \
--color=yes \
--cov=seedsigner \
--cov-branch \
--durations 5 \
-vv
- name: Generate screenshots
run: |
python -m pytest tests/screenshot_generator/generator.py \
--color=yes \
--cov=seedsigner \
--cov-append \
--cov-branch \
--cov-report html:./artifacts/cov_html \
-vv
cp -r ./seedsigner-screenshots ./artifacts/
- name: Coverage report
run: coverage report
- name: Archive CI Artifacts
uses: actions/upload-artifact@v7
with:
name: ci-artifacts-${{ matrix.python-version }}
path: artifacts/**
retention-days: 10
# Upload also when tests fail. The workflow result (red/green) will
# not be affected by this.
if: always()
desktop:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12", "3.13", "3.14"]
exclude:
# Windows + Python 3.14: no pre-built cp314 wheels for embit,
# cffi, pyscard; building from source causes segfaults.
- os: windows-latest
python-version: "3.14"
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install OS packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gnupg2 pinentry-curses pinentry-tty libzbar0 libpcsclite-dev pcscd swig
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-desktop.txt -r tests/requirements.txt
# requirements-l10n.txt is hash-locked and needs its own pip invocation:
# one hashed requirement makes pip demand hashes for everything else in
# the same invocation, which the unhashed files above and `-e .` below
# can't satisfy.
pip install -r l10n/requirements-l10n.txt
pip install -e .
- name: Compile translations
run: python setup.py compile_catalog
- name: Test with pytest
run: |
python -m pytest \
--color=yes \
--cov=seedsigner \
--cov-append \
--cov-branch \
--durations 5 \
-vv