-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
665 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
## Description | ||
|
||
_Describe the change simply. Provide a reason for the change._ | ||
|
||
_Include screenshots of any new or modified screens (or at least explain why they were omitted)_ | ||
|
||
This pull request is categorized as a: | ||
|
||
- [ ] New feature | ||
- [ ] Bug fix | ||
- [ ] Code refactor | ||
- [ ] Documentation | ||
- [ ] Other | ||
|
||
## Checklist | ||
|
||
- [ ] I’ve run `pytest` and made sure all unit tests pass before sumbitting the PR | ||
|
||
If you modified or added functionality/workflow, did you add new unit tests? | ||
|
||
- [ ] No, I’m a fool | ||
- [ ] Yes | ||
- [ ] N/A | ||
|
||
I have tested this PR on the following platforms/os: | ||
|
||
- [ ] Raspberry Pi OS [Manual Build](https://github.com/SeedSigner/seedsigner/blob/dev/docs/manual_installation.md) | ||
- [ ] [SeedSigner OS](https://github.com/SeedSigner/seedsigner-os) on a Pi0/Pi0W board | ||
- [ ] Other | ||
|
||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [ "pi0", "pi2", "pi02w", "pi4" ] | ||
steps: | ||
- name: checkout seedsigner-os | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: "seedsigner/seedsigner-os" | ||
submodules: true | ||
path: "seedsigner-os" | ||
|
||
- name: get seedsigner-os latest commit hash | ||
id: get-seedsigner-os-hash | ||
run: | | ||
cd seedsigner-os | ||
echo "builder_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
- name: checkout source | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "seedsigner-os/opt/rootfs-overlay/opt" | ||
|
||
- name: get seedsigner latest commit hash | ||
id: get-seedsigner-hash | ||
run: | | ||
git init | ||
echo "source_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | ||
- name: delete unnecessary files | ||
run: | | ||
cd seedsigner-os/opt/rootfs-overlay/opt | ||
find . -mindepth 1 -maxdepth 1 ! -name src -exec rm -rf {} + | ||
ls -la . | ||
ls -la src | ||
- name: restore build cache | ||
id: build-cache-restore | ||
uses: actions/cache/restore@v3 | ||
# Caching seedsigner-os/buildroot_dl is optional. | ||
# Caching it can save a small amount of build time, | ||
# but it will occupy a larger amount of storage space. | ||
with: | ||
path: | | ||
~/.buildroot-ccache/ | ||
seedsigner-os/buildroot_dl | ||
key: build-cache-${{ matrix.target }}-${{ env.builder_hash }} | ||
restore-keys: | | ||
build-cache-${{ matrix.target }}- | ||
- name: build | ||
run: | | ||
cd seedsigner-os/opt | ||
./build.sh --${{ matrix.target }} --skip-repo --no-clean | ||
- name: save build cache | ||
id: build-cache-save | ||
if: steps.build-cache-restore.outputs.cache-hit != 'true' | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: | | ||
~/.buildroot-ccache/ | ||
seedsigner-os/buildroot_dl | ||
key: build-cache-${{ matrix.target }}-${{ env.builder_hash }} | ||
|
||
- name: list image (before rename) | ||
run: | | ||
ls -la seedsigner-os/images | ||
- name: rename image | ||
run: | | ||
cd seedsigner-os/images | ||
mv seedsigner_os*.img seedsigner_os.${{ env.source_hash }}.${{ matrix.target }}.img | ||
- name: print sha256sum | ||
run: | | ||
cd seedsigner-os/images | ||
sha256sum *.img | ||
- name: list image (after rename) | ||
run: | | ||
ls -la seedsigner-os/images | ||
- name: upload images | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: seedsigner_os_images | ||
path: "seedsigner-os/images/*.img" | ||
if-no-files-found: error | ||
|
||
sha256sum: | ||
name: calculate sha256sum | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: download images | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: seedsigner_os_images | ||
path: images | ||
|
||
- name: list images | ||
run: | | ||
ls -la images | ||
- name: get seedsigner latest commit hash | ||
id: get-seedsigner-hash | ||
run: | | ||
git init | ||
echo "source_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | ||
- name: write sha256sum | ||
run: | | ||
cd images | ||
sha256sum *.img > seedsigner_os.${{ env.source_hash }}.sha256 | ||
- name: upload checksums | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: seedsigner_os_images | ||
path: "images/*.sha256" | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- main | ||
pull_request: | ||
|
||
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 | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get install libzbar0 | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r tests/requirements.txt | ||
python setup.py install | ||
- name: Test with pytest | ||
run: | | ||
mkdir artifacts | ||
python -m pytest \ | ||
--color=yes \ | ||
--cov=seedsigner \ | ||
--cov-append \ | ||
--cov-branch \ | ||
--cov-report term \ | ||
--cov-report html \ | ||
--cov-report html:./artifacts/cov_html \ | ||
--cov-report xml \ | ||
--durations 5 \ | ||
-vv | ||
- name: Generate screenshots | ||
run: | | ||
python -m pytest tests/screenshot_generator/generator.py | ||
cp -r ./seedsigner-screenshots ./artifacts/ | ||
- name: Archive CI Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ci-artifacts | ||
path: artifacts/** | ||
retention-days: 10 | ||
# Upload also when tests fail. The workflow result (red/green) will | ||
# be not effected by this. | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
recursive-include src/seedsigner/resources * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3.7' | ||
|
||
services: | ||
seedsigner-dev: | ||
build: | ||
context: . | ||
dockerfile: docker/Dockerfile | ||
command: sh -c 'bash -c "docker/setup.sh"' | ||
volumes: | ||
- ../seedsigner:/seedsigner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM python:3.10-bullseye | ||
|
||
# install zbar dependencyy | ||
RUN apt-get -qq update | ||
RUN apt-get -y -qq install zbar-tools | ||
|
||
# temp copy requirements files to local repo to do pip3 install | ||
COPY ../requirements.txt /requirements.txt | ||
COPY ../tests/requirements.txt /tests-requirements.txt | ||
|
||
WORKDIR / | ||
RUN pip3 install -r requirements.txt | ||
RUN pip3 install -r tests-requirements.txt | ||
|
||
# clean up copied files | ||
RUN rm /requirements.txt | ||
RUN rm /tests-requirements.txt | ||
|
||
# set working dir | ||
WORKDIR /seedsigner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
pip3 install -e . | ||
tail -f /dev/null |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.