Repository navigation
60 lines (51 loc) · 2.28 KB
/
Copy pathexamples.yaml
File metadata and controls
60 lines (51 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Examples on Devnet
# Runs the examples in `examples/` against Devnet with `make examples`. The workflow needs no repository secret. Each
# run creates a throwaway account (`examples/faucet_funder.py`), funds it with one request to the Devnet faucet, and
# runs the examples from that account: they fund the accounts they generate by transfers from it and request nothing
# from the faucet. `faucet.py` is excluded because its own request would be a second faucet request from the
# runner's IP address, and the funding step makes the same SDK faucet call. The key of the throwaway account is
# masked in the log and never written anywhere else.
on:
schedule:
- cron: "41 4 * * *"
workflow_dispatch:
permissions:
contents: read
# The Devnet faucet limits requests per IP address, and runners share addresses. One run at a time keeps two runs from
# drawing on the faucet allowance of one IP address at once.
concurrency:
group: examples-devnet
cancel-in-progress: false
jobs:
examples:
name: Examples on Devnet
runs-on: ubuntu-latest
timeout-minutes: 30
env:
SUPRA_RPC_NODE_URL: https://rpc-devnet.supra.com
UV_PYTHON: "3.12"
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
version: "0.13.7"
python-version: "3.12"
- name: Install dependencies
run: uv sync --frozen
# The uv release and the packages are fixed by the steps above. UV_FROZEN makes `uv run` use uv.lock without
# resolving, and UV_NO_SYNC makes it skip syncing the environment, so nothing is resolved, downloaded or
# installed once the key exists. The funder prints only the private key on stdout; `::add-mask::` hides it in
# the log before anything else can print it.
- name: Fund an account and run the examples
env:
UV_FROZEN: "1"
UV_NO_SYNC: "1"
run: |
set -euo pipefail
key="$(uv run python -m examples.faucet_funder)"
echo "::add-mask::$key"
SUPRA_EXAMPLES_PRIVATE_KEY="$key" make examples EXAMPLES_EXCLUDE=faucet