Skip to content

Commit ee899b2

Browse files
authored
Merge pull request #612 from SeedSigner/0.8.0
Update main branch from 0.8.0 branch
2 parents 7471d00 + cd3e0f3 commit ee899b2

File tree

218 files changed

+9927
-2727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+9927
-2727
lines changed

.github/pull_request_template.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## Description
2+
3+
_Describe the change simply. Provide a reason for the change._
4+
5+
_Include screenshots of any new or modified screens (or at least explain why they were omitted)_
6+
7+
This pull request is categorized as a:
8+
9+
- [ ] New feature
10+
- [ ] Bug fix
11+
- [ ] Code refactor
12+
- [ ] Documentation
13+
- [ ] Other
14+
15+
## Checklist
16+
17+
- [ ] I’ve run `pytest` and made sure all unit tests pass before sumbitting the PR
18+
19+
If you modified or added functionality/workflow, did you add new unit tests?
20+
21+
- [ ] No, I’m a fool
22+
- [ ] Yes
23+
- [ ] N/A
24+
25+
I have tested this PR on the following platforms/os:
26+
27+
- [ ] Raspberry Pi OS [Manual Build](https://github.com/SeedSigner/seedsigner/blob/dev/docs/manual_installation.md)
28+
- [ ] [SeedSigner OS](https://github.com/SeedSigner/seedsigner-os) on a Pi0/Pi0W board
29+
- [ ] Other
30+
31+
32+
Note: Keep your changes limited in scope; if you uncover other issues or improvements along the way, ideally submit those as a separate PR. The more complicated the PR the harder to review, test, and merge.

.github/workflows/build.yml

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
# Build on changes to this workflow files in PRs to test proposed changes
6+
paths:
7+
- '.github/workflows/build.yml'
8+
push:
9+
branches:
10+
- main
11+
- dev
12+
workflow_dispatch:
13+
inputs:
14+
os-ref:
15+
description: The seedsigner-os ref (tag/branch/sha1) to use
16+
default: main
17+
required: true
18+
19+
# Increment this number as part of a PR to trigger an image build for the PR
20+
# trigger = 0
21+
22+
jobs:
23+
build:
24+
name: build
25+
runs-on: ubuntu-latest
26+
# Prevent resource consuming cron triggered runs in forks
27+
if: (!github.event.repository.fork || github.event_name == 'workflow_dispatch')
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
target: [ "pi0", "pi2", "pi02w", "pi4" ]
32+
steps:
33+
- name: checkout seedsigner-os
34+
uses: actions/checkout@v3
35+
with:
36+
repository: "seedsigner/seedsigner-os"
37+
# use the os-ref input parameter in case of workflow_dispatch or default to main in case of cron triggers
38+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.os-ref || 'main' }}
39+
submodules: true
40+
path: "seedsigner-os"
41+
# get full history + tags for "git describe"
42+
fetch-depth: 0
43+
44+
- name: checkout source
45+
uses: actions/checkout@v3
46+
with:
47+
# ref defaults to repo default-branch=dev (cron) or SHA of event (workflow_dispatch)
48+
path: "seedsigner-os/opt/rootfs-overlay/opt"
49+
# get full history + tags for "git describe"
50+
fetch-depth: 0
51+
52+
- name: Get and set meta data
53+
run: |
54+
# The builder_hash (seedsigner-os hash) for the cache action step key
55+
echo "builder_hash=$(git -C seedsigner-os rev-parse --short HEAD)"| tee -a $GITHUB_ENV
56+
57+
# Derive tag based versions, like 0.7.0-40-g0424967 (=$tag-$number-of-commits-since-tag-$short-sha1),
58+
# or just e.g. 0.7.0, if we are exactly on a 0.7.0 tagged commit.
59+
# --always to fall back to commit sha, if no tag present like in partial forks of the repo
60+
os_version="$(git -C seedsigner-os describe --tags --always)"
61+
source_version="$(git -C seedsigner-os/opt/rootfs-overlay/opt describe --tags --always)"
62+
63+
# Combine seedsigner and seedsigner-os version into one version string and squash the versions, if
64+
# they are identical: So os_version=0.7.0 + source_version=0.7.0 combine to just only "0.7.0",
65+
# whereas os_version=0.6.0-61-g9fafebe + source_version=0.7.0-40-g0424967 combine to "os0.6.0-61-g9fafebe_sw0.7.0-40-g0424967"
66+
if [ "${os_version}" = "${source_version}" ]; then
67+
# seedsigner + seedsigner_os have the same tag
68+
echo "img_version=${source_version}"| tee -a $GITHUB_ENV
69+
else
70+
echo "img_version=os${os_version}_sw${source_version}"| tee -a $GITHUB_ENV
71+
fi
72+
73+
- name: delete unnecessary files
74+
run: |
75+
cd seedsigner-os/opt/rootfs-overlay/opt
76+
find . -mindepth 1 -maxdepth 1 ! -name src -exec rm -rf {} +
77+
ls -la .
78+
ls -la src
79+
80+
- name: restore build cache
81+
uses: actions/cache@v3
82+
# Caching reduces the build time to ~50% (currently: ~30 mins instead of ~1 hour,
83+
# while consuming ~850 MB storage space).
84+
with:
85+
path: |
86+
~/.buildroot-ccache/
87+
seedsigner-os/buildroot_dl
88+
key: build-cache-${{ matrix.target }}-${{ env.builder_hash }}
89+
restore-keys: |
90+
build-cache-${{ matrix.target }}-
91+
92+
- name: build
93+
run: |
94+
cd seedsigner-os/opt
95+
./build.sh --${{ matrix.target }} --skip-repo --no-clean
96+
97+
- name: list image (before rename)
98+
run: |
99+
ls -la seedsigner-os/images
100+
101+
- name: rename image
102+
run: |
103+
cd seedsigner-os/images
104+
mv seedsigner_os*.img seedsigner_os.${{ env.img_version }}.${{ matrix.target }}.img
105+
106+
- name: print sha256sum
107+
run: |
108+
cd seedsigner-os/images
109+
sha256sum *.img
110+
111+
- name: list image (after rename)
112+
run: |
113+
ls -la seedsigner-os/images
114+
115+
- name: upload images
116+
uses: actions/upload-artifact@v3
117+
with:
118+
name: seedsigner_os_images
119+
path: "seedsigner-os/images/*.img"
120+
if-no-files-found: error
121+
# maximum 90 days retention
122+
retention-days: 90
123+
124+
sha256sum:
125+
name: calculate sha256sum
126+
runs-on: ubuntu-latest
127+
needs: build
128+
steps:
129+
- name: download images
130+
uses: actions/download-artifact@v3
131+
with:
132+
name: seedsigner_os_images
133+
path: images
134+
135+
- name: list images
136+
run: |
137+
ls -la images
138+
139+
- name: get seedsigner latest commit hash
140+
id: get-seedsigner-hash
141+
run: |
142+
git init
143+
echo "source_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
144+
145+
- name: write sha256sum
146+
run: |
147+
cd images
148+
sha256sum *.img > seedsigner_os.${{ env.source_hash }}.sha256
149+
150+
- name: upload checksums
151+
uses: actions/upload-artifact@v3
152+
with:
153+
name: seedsigner_os_images
154+
path: "images/*.sha256"
155+
if-no-files-found: error
156+
# maximum 90 days retention
157+
retention-days: 90

.github/workflows/tests.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- main
8+
pull_request:
9+
10+
concurrency:
11+
# Concurrency group that uses the workflow name and PR number if available
12+
# or commit SHA as a fallback. If a new build is triggered under that
13+
# concurrency group while a previous build is running it will be canceled.
14+
# Repeated pushes to a PR will cancel all previous builds, while multiple
15+
# merges to main will not cancel.
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
# 3.10: currently used by Seedsigner
25+
# 3.12: latest stable Python as upper test bound
26+
python-version: ["3.10", "3.12"]
27+
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
- name: Install dependencies
35+
run: |
36+
sudo apt-get install libzbar0
37+
python -m pip install --upgrade pip
38+
pip install -r requirements.txt -r tests/requirements.txt
39+
pip install .
40+
- name: Test with pytest
41+
run: |
42+
mkdir artifacts
43+
python -m pytest \
44+
--color=yes \
45+
--cov=seedsigner \
46+
--cov-append \
47+
--cov-branch \
48+
--cov-report term \
49+
--cov-report html \
50+
--cov-report html:./artifacts/cov_html \
51+
--cov-report xml \
52+
--durations 5 \
53+
-vv
54+
- name: Generate screenshots
55+
run: |
56+
python -m pytest tests/screenshot_generator/generator.py
57+
cp -r ./seedsigner-screenshots ./artifacts/
58+
- name: Archive CI Artifacts
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: ci-artifacts
62+
path: artifacts/**
63+
retention-days: 10
64+
# Upload also when tests fail. The workflow result (red/green) will
65+
# be not effected by this.
66+
if: always()

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ src/seedsigner.egg-info/
44
.nova
55
.vscode
66
src/seedsigner/models/settings_definition.json
7+
.idea
8+
*.mo
9+
.coverage
10+
seedsigner-screenshots

0 commit comments

Comments
 (0)