Skip to content

Commit

Permalink
Add repro-env config for reproducible firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcyrd committed Nov 29, 2023
1 parent a71937b commit 8d31f3b
Show file tree
Hide file tree
Showing 4 changed files with 493 additions and 2 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/repro-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: repro-env

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 9 * * 1'

env:
REPRO_ENV_URL: https://github.com/kpcyrd/repro-env/releases/download/v0.3.2/repro-env
REPRO_ENV_SHA256: 660995089d32178a63763cf47e1b97e265ef5cf24bf646d16728ca51bf2fab50

jobs:
firmware:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Install repro-env
run: |
wget "${REPRO_ENV_URL}"
echo "${REPRO_ENV_SHA256} repro-env" | sha256sum -c -
sudo install -m755 repro-env -t /usr/bin
- name: Build
run: |
repro-env build -- sh -c '
D3XS_DOOR_KEY="w/CSnPJnWTaEIYpEvXvF+ktwh236iSDZfSx6hExB4bM=" \
D3XS_BRIDGE_KEY="cW49lkXDeM0wOT8N7QxAWePmWs8xZK1FXt1uQT/pcG4=" \
make firmware'
- name: Print sha256 of binary
run: sha256sum target-firmware/riscv32imc-esp-espidf/release/d3xs-firmware

binaries:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Install repro-env
run: |
wget "${REPRO_ENV_URL}"
echo "${REPRO_ENV_SHA256} repro-env" | sha256sum -c -
sudo install -m755 repro-env -t /usr/bin
- name: Build
run: |
repro-env build -- sh -c 'make wasm && RUSTFLAGS="-C strip=symbols" cargo build --release --locked -p d3xs -p d3xs-bridge --target x86_64-unknown-linux-musl'
- name: Print sha256 of binaries
run: sha256sum target/x86_64-unknown-linux-musl/release/{d3xs,d3xs-bridge}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
build: wasm binaries firmware

wasm:
CARGO_TARGET_DIR=$${CARGO_TARGET_DIR:-$(PWD)/target-wasm} wasm-pack build --release --target web protocol/
CARGO_TARGET_DIR=$${CARGO_TARGET_DIR:-$(shell pwd)/target-wasm} wasm-pack build --release --target web protocol/

binaries: wasm bridge
cargo build --release --locked -p d3xs
Expand All @@ -12,4 +12,4 @@ bridge:
cargo build --release --locked -p d3xs-bridge

firmware:
cd firmware; CARGO_TARGET_DIR=$${CARGO_TARGET_DIR:-$(PWD)/target-firmware} RUSTC_BOOTSTRAP=1 cargo build --release
cd firmware; CARGO_TARGET_DIR=$${CARGO_TARGET_DIR:-$(shell pwd)/target-firmware} RUSTC_BOOTSTRAP=1 cargo build --release
Loading

0 comments on commit 8d31f3b

Please sign in to comment.