Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from Foundation-Devices/dev-v2.0.7
Dev v2.0.7
- Loading branch information
Showing
699 changed files
with
5,623 additions
and
5,982 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 |
---|---|---|
@@ -1,182 +1,202 @@ | ||
# SPDX-FileCopyrightText: 2021 Foundation Devices, Inc. <hello@foundationdevices.com> | ||
# SPDX-FileCopyrightText: © 2021 Foundation Devices, Inc. <hello@foundationdevices.com> | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
# validate_and_build.yaml - GitHub actions for Passport | ||
|
||
name: Validate and Build | ||
on: [push] | ||
jobs: | ||
lint-py: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
cache: 'pip' | ||
- name: Install pycodestyle | ||
run: pip install pycodestyle | ||
- name: Run pycodestyle | ||
run: | | ||
STYLE_TEMP=$(mktemp) | ||
if ! pycodestyle --exclude trezor-firmware,unused_modules,graphics.py,translations --statistics ports/stm32/boards/Passport | tee "$STYLE_TEMP" | ||
then | ||
sed -n -e 's/^\(.*\.py\):\([[:digit:]]\+\):\([[:digit:]]\+\): \(E[[:digit:]]\+\) \(.*\)$/::error file=\1,line=\2,col=\3,title=\4::\5/p' < "$STYLE_TEMP" | ||
sed -n -e 's/^\(.*\.py\):\([[:digit:]]\+\):\([[:digit:]]\+\): \(W[[:digit:]]\+\) \(.*\)$/::warning file=\1,line=\2,col=\3,title=\4::\5/p' < "$STYLE_TEMP" | ||
exit 1 | ||
fi | ||
lint-c: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-20.04 | ||
|
||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Analysing the code | ||
uses: jidicula/clang-format-action@7f6b4bf5a7eb211c0872364ccd8072ff8a77ac44 | ||
with: | ||
clang-format-version: '10' | ||
check-path: ./ports/stm32 | ||
exclude-regex: trezor-firmware | ||
continue-on-error: true | ||
fetch-depth: 0 | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: network=host | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: . | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
tags: localhost:5000/foundation-devices/passport2:latest | ||
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb | ||
- run: echo "DOCKER_IMAGE=localhost:5000/foundation-devices/passport2:latest" >> $GITHUB_ENV | ||
|
||
lint-reuse: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: REUSE Compliance Check | ||
uses: fsfe/reuse-action@v1 | ||
continue-on-error: true | ||
- name: Lint the codebase | ||
run: just lint | ||
|
||
build-firmware: | ||
name: Build Firmware | ||
runs-on: ubuntu-20.04 | ||
needs: [lint-py, lint-c, lint-reuse] | ||
needs: [lint] | ||
|
||
strategy: | ||
matrix: | ||
screen: ["mono", "color"] | ||
|
||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: network=host | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build the dependency Docker image | ||
uses: docker/build-push-action@v2 | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: localhost:5000/foundation-devices/firmware-builder:${{ github.sha }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Setup just | ||
uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb | ||
|
||
# - name: Build the mono firmware | ||
# run: | | ||
# echo "$SIGNING_KEY" > ports/stm32/signing_key.pem | ||
# version=$(cat version.txt) | ||
|
||
# just DOCKER_REGISTRY_BASE="$D_BASE" sign signing_key.pem "${version}" mono | ||
# env: | ||
# SIGNING_KEY: ${{ secrets.UserSigningKey }} | ||
# D_BASE: localhost:5000/ | ||
|
||
# - name: Upload unsigned mono firmware file | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: firmware-MONO.bin | ||
# path: ports/stm32/build-Passport/firmware-MONO.bin | ||
|
||
# - name: Upload signed mono firmware file | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: firmware-MONO-key-user.bin | ||
# path: ports/stm32/build-Passport/firmware-MONO-key-user.bin | ||
|
||
- name: Clean firmware between different screen builds | ||
run: just DOCKER_REGISTRY_BASE="$D_BASE" clean | ||
env: | ||
D_BASE: localhost:5000/ | ||
|
||
- name: Build the color firmware | ||
context: . | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
tags: localhost:5000/foundation-devices/passport2:latest | ||
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb | ||
- run: | | ||
echo "DOCKER_IMAGE=localhost:5000/foundation-devices/passport2:latest" >> $GITHUB_ENV | ||
echo "SCREEN_MODE=$(echo "${{ matrix.screen }}" | tr a-z A-Z)" >> $GITHUB_ENV | ||
- name: Build | ||
run: | | ||
echo "$SIGNING_KEY" > ports/stm32/signing_key.pem | ||
version=$(cat version.txt) | ||
just DOCKER_REGISTRY_BASE="$D_BASE" sign signing_key.pem "${version}" color | ||
just sign signing_key.pem "${version}" ${{ matrix.color }} | ||
env: | ||
SIGNING_KEY: ${{ secrets.UserSigningKey }} | ||
D_BASE: localhost:5000/ | ||
|
||
- name: Upload unsigned color firmware file | ||
- name: Upload firmware (unsigned) | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: firmware-COLOR.bin | ||
path: ports/stm32/build-Passport/firmware-COLOR.bin | ||
name: firmware-${{ env.SCREEN_MODE }}.bin | ||
path: ports/stm32/build-Passport/firmware-${{ env.SCREEN_MODE }}.bin | ||
|
||
- name: Upload signed color firmware file | ||
- name: Upload firmware (signed) | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: firmware-COLOR-key-user.bin | ||
path: ports/stm32/build-Passport/firmware-COLOR-key-user.bin | ||
|
||
# - name: Build the mono bootloader | ||
# run: just DOCKER_REGISTRY_BASE="$D_BASE" build-bootloader mono | ||
# env: | ||
# D_BASE: localhost:5000/ | ||
name: firmware-${{ env.SCREEN_MODE }}-key-user.bin | ||
path: ports/stm32/build-Passport/firmware-${{ env.SCREEN_MODE }}-key-user.bin | ||
|
||
# - name: Upload mono bootloader | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: bootloader-MONO.bin | ||
# path: ports/stm32/boards/Passport/bootloader/arm/release/bootloader-MONO.bin | ||
build-bootloader: | ||
name: Build Bootloader | ||
runs-on: ubuntu-20.04 | ||
needs: [lint, build-firmware] | ||
|
||
- name: Clean bootloader between different screen builds | ||
run: just DOCKER_REGISTRY_BASE="$D_BASE" clean-bootloader | ||
env: | ||
D_BASE: localhost:5000/ | ||
# TODO: PASS1-665. | ||
strategy: | ||
matrix: | ||
screen: ["color"] | ||
|
||
- name: Build the color bootloader | ||
run: just DOCKER_REGISTRY_BASE="$D_BASE" build-bootloader color | ||
env: | ||
D_BASE: localhost:5000/ | ||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
|
||
- name: Upload color bootloader | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: network=host | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: . | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
tags: localhost:5000/foundation-devices/passport2:latest | ||
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb | ||
- run: | | ||
echo "DOCKER_IMAGE=localhost:5000/foundation-devices/passport2:latest" >> $GITHUB_ENV | ||
echo "SCREEN_MODE=$(echo ${{ matrix.screen }} | tr a-z A-Z)" >> $GITHUB_ENV | ||
- name: Build | ||
run: just build-bootloader ${{ matrix.screen }} | ||
|
||
- name: Upload bootloader | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: bootloader-COLOR.bin | ||
path: ports/stm32/boards/Passport/bootloader/arm/release/bootloader-COLOR.bin | ||
name: bootloader-${{ env.SCREEN_MODE }}.bin | ||
path: ports/stm32/boards/Passport/bootloader/arm/release/bootloader-${{ env.SCREEN_MODE }}.bin | ||
|
||
- name: Build and make tools available | ||
run: just DOCKER_REGISTRY_BASE="$D_BASE" tools | ||
env: | ||
D_BASE: localhost:5000/ | ||
build-simulator: | ||
name: Build Simulator | ||
runs-on: ubuntu-20.04 | ||
needs: [lint, build-firmware] | ||
|
||
# - name: Build the mono simulator | ||
# run: | | ||
# just DOCKER_REGISTRY_BASE="$D_BASE" clean-simulator | ||
# just DOCKER_REGISTRY_BASE="$D_BASE" build-simulator mono | ||
# env: | ||
# D_BASE: localhost:5000/ | ||
strategy: | ||
matrix: | ||
screen: ["mono", "color"] | ||
|
||
- name: Build the color simulator | ||
run: | | ||
just DOCKER_REGISTRY_BASE="$D_BASE" clean-simulator | ||
just DOCKER_REGISTRY_BASE="$D_BASE" build-simulator color | ||
env: | ||
D_BASE: localhost:5000/ | ||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: network=host | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: . | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
tags: localhost:5000/foundation-devices/passport2:latest | ||
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb | ||
- run: echo "DOCKER_IMAGE=localhost:5000/foundation-devices/passport2:latest" >> $GITHUB_ENV | ||
|
||
- name: Build | ||
run: just build-simulator ${{ matrix.screen }} | ||
|
||
build-tools: | ||
name: Build Tools | ||
runs-on: ubuntu-20.04 | ||
needs: [lint] | ||
|
||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: docker/setup-buildx-action@v1 | ||
with: | ||
driver-opts: network=host | ||
- uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: . | ||
cache-from: type=gha | ||
cache-to: type=gha | ||
tags: localhost:5000/foundation-devices/passport2:latest | ||
- uses: extractions/setup-just@aa5d15c144db4585980a44ebfdd2cf337c4f14cb | ||
- run: echo "DOCKER_IMAGE=localhost:5000/foundation-devices/passport2:latest" >> $GITHUB_ENV | ||
|
||
- name: Build | ||
run: just tools |
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
Oops, something went wrong.