Skip to content

Commit 3b4ad16

Browse files
committed
progress
1 parent 4faf74d commit 3b4ad16

File tree

13 files changed

+507
-70
lines changed

13 files changed

+507
-70
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/gradle
2+
/.jj
3+
/.git
4+
/target
5+
/benchmark
6+
/crates/rust-sample-wallet/dist
7+
/crates/rust-sample-wallet/node_modules
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Deploy Sign Sample to Github Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- push-tlltnpmvwzwm
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write # for committing to gh-pages branch.
12+
pages: write
13+
id-token: write
14+
15+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
16+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
Github-Pages-Release:
23+
24+
timeout-minutes: 10
25+
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- uses: actions/checkout@v4 # repo checkout
34+
35+
# Install Rust Nightly Toolchain, with Clippy & Rustfmt
36+
- name: Install nightly Rust
37+
uses: dtolnay/rust-toolchain@nightly
38+
with:
39+
components: clippy, rustfmt
40+
41+
- name: Add WASM target
42+
run: rustup target add wasm32-unknown-unknown
43+
44+
- name: Download and install Trunk binary
45+
run: wget -qO- https://github.com/trunk-rs/trunk/releases/download/v0.18.4/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
46+
47+
- name: Build with Trunk
48+
# "${GITHUB_REPOSITORY#*/}" evaluates into the name of the repository
49+
# using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico .
50+
# this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested
51+
# relatively as favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which
52+
# will obviously return error 404 not found.
53+
run: ../../trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
54+
working-directory: crates/rust-sample-wallet
55+
env:
56+
REOWN_PROJECT_ID: ${{ vars.REOWN_PROJECT_ID }}
57+
58+
59+
# Deploy to gh-pages branch
60+
# - name: Deploy 🚀
61+
# uses: JamesIves/github-pages-deploy-action@v4
62+
# with:
63+
# folder: dist
64+
65+
66+
# Deploy with Github Static Pages
67+
68+
- name: Setup Pages
69+
uses: actions/configure-pages@v4
70+
with:
71+
enablement: true
72+
73+
- name: Upload artifact
74+
uses: actions/upload-pages-artifact@v3
75+
with:
76+
# Upload dist dir
77+
path: './crates/rust-sample-wallet/dist'
78+
79+
- name: Deploy to GitHub Pages 🚀
80+
id: deployment
81+
uses: actions/deploy-pages@v4
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: publish_sign_canary
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
- push-yruotstkupns
8+
- push-tlltnpmvwzwm
9+
10+
concurrency: ${{ github.workflow }}
11+
12+
env:
13+
TERM: linux
14+
15+
jobs:
16+
push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
id-token: write
20+
steps:
21+
- name: Configure AWS Credentials
22+
uses: aws-actions/configure-aws-credentials@v4
23+
with:
24+
aws-access-key-id: ${{ secrets.AWS_ECR_PUBLISHER_ACCESS_KEY_ID }}
25+
aws-secret-access-key: ${{ secrets.AWS_ECR_PUBLISHER_SECRET_ACCESS_KEY }}
26+
aws-region: eu-central-1
27+
28+
- name: Login to Amazon ECR
29+
id: login-ecr
30+
uses: aws-actions/amazon-ecr-login@v2
31+
with:
32+
mask-password: 'true'
33+
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Cache Docker layers
41+
uses: actions/cache@v4
42+
with:
43+
path: /tmp/.buildx-cache
44+
key: ${{ runner.os }}-buildx-${{ github.sha }}
45+
restore-keys: |
46+
${{ runner.os }}-buildx-
47+
48+
- name: Build, tag, and push image to Amazon ECR
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
file: canary/Dockerfile
53+
push: true
54+
tags: ${{ steps.login-ecr.outputs.registry }}/rust-sign-client:${{ github.sha }},${{ steps.login-ecr.outputs.registry }}/rust-sign-client:main
55+
cache-from: type=local,src=/tmp/.buildx-cache
56+
cache-to: type=local,dest=/tmp/.buildx-cache-new
57+
58+
# Temp fix
59+
# https://github.com/docker/build-push-action/issues/252
60+
# https://github.com/moby/buildkit/issues/1896
61+
- name: Move cache
62+
run: |
63+
rm -rf /tmp/.buildx-cache
64+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

canary/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM rust:1 AS chef
2+
# We only pay the installation cost once,
3+
# it will be cached from the second build onwards
4+
RUN cargo install cargo-chef
5+
WORKDIR /app
6+
7+
FROM chef AS planner
8+
COPY . .
9+
RUN cargo chef prepare --recipe-path recipe.json
10+
11+
FROM chef AS builder
12+
COPY --from=planner /app/recipe.json recipe.json
13+
# Build dependencies - this is the caching Docker layer!
14+
RUN cargo chef cook --release --recipe-path recipe.json
15+
# Build application
16+
COPY . .
17+
RUN cargo build --release --bin sign-canary --features=sign_canary
18+
19+
# We do not need the Rust toolchain to run the binary!
20+
FROM debian:bookworm-slim AS runtime
21+
WORKDIR /app
22+
COPY --from=builder /app/target/release/sign-canary /usr/local/bin
23+
ENTRYPOINT ["/usr/local/bin/sign-canary"]

crates/yttrium/Cargo.toml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ name = "uniffi-bindgen"
1313
path = "uniffi-bindgen.rs"
1414
required-features = ["uniffi"]
1515

16+
[[bin]]
17+
name = "sign-canary"
18+
path = "src/bin/sign_canary.rs"
19+
required-features = ["sign_canary"]
20+
1621
[features]
1722
default = ["eip155", "erc6492_client", "chain_abstraction_client"]
1823
full = ["all_platforms", "all_clients", "all_namespaces"]
@@ -96,6 +101,12 @@ sign_client = [
96101
"dep:tokio-util",
97102
]
98103

104+
sign_canary = [
105+
"sign_client",
106+
"dep:aws-config",
107+
"dep:aws-sdk-cloudwatch",
108+
]
109+
99110
# Features enabling test coverage
100111
test_full = [
101112
"test_pimlico_api",
@@ -236,6 +247,9 @@ x25519-dalek = { version = "3.0.0-pre.0", features = [
236247
hkdf = { version = "0.13.0-rc.0", optional = true }
237248
sha2 = { version = "0.11.0-rc.0", optional = true }
238249

250+
aws-config = { version = "1.1.7", features = ["behavior-version-latest"], optional = true }
251+
aws-sdk-cloudwatch = { version = "1.91.0", optional = true }
252+
239253
[dev-dependencies]
240254
# mocking
241255
wiremock = { version = "0.6.0", default-features = false }
@@ -250,8 +264,5 @@ serial_test.workspace = true
250264
chacha20poly1305 = { workspace = true, features = ["alloc", "os_rng"] }
251265
data-encoding = { workspace = true }
252266

253-
aws-config = { version = "1.1.7", features = ["behavior-version-latest"] }
254-
aws-sdk-cloudwatch = { version = "1.91.0" }
255-
256267
[package.metadata.wasm-pack.profile.release]
257268
wasm-opt = ['-Oz']

0 commit comments

Comments
 (0)