-
Notifications
You must be signed in to change notification settings - Fork 15
158 lines (150 loc) · 6.1 KB
/
project.yml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Fadroma (Project)
on: [push]
jobs:
# Here we test creating a project from a TypeScript source checkout of Fadroma,
# compiled on demand using the @hackbg/ganesha module loader
project-gh:
name: pnpm ci
runs-on: ubuntu-latest
steps:
- name: Clone with submodules
uses: actions/checkout@v4
with: { submodules: recursive }
- name: Setup PNPM
uses: pnpm/action-setup@v2
with: { version: 7.29.1 }
- name: Setup Node 19
uses: actions/setup-node@v3
with:
node-version: "19"
check-latest: true
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Run pnpm ci
env:
FORCE_COLOR: 2
run: |
sudo apt install -y wabt binaryen cloc
mkdir -p wasm
rustup default 1.69
rustup target add wasm32-unknown-unknown --toolchain 1.69
pnpm --version
pnpm i --frozen-lockfile
FORCE_COLOR=1 FADROMA_BUILD_RAW=1 TEMP="$(dirname $(pwd))" TMP="$(dirname $(pwd))" pnpm run ci
- name: Create, build, and deploy project
env:
FORCE_COLOR: 2
run: |
../fadroma/fadroma.cli.cjs create testproject test1 test2
cd testproject
cat package.json
cat fadroma.yml
cat api.ts
cat ops.ts
echo '{"name":"testproject","main":"api.ts","type":"module","version":"0.1.0","dependencies":{"@fadroma/agent":"link:../fadroma/agent","@fadroma/scrt":"link:../fadroma/scrt"},"devDependencies":{"@hackbg/fadroma":"link:../fadroma","@hackbg/ganesha":"link:../fadroma/ensuite/ganesha","typescript":"^5"},"scripts":{"build":"fadroma build","status":"fadroma status","mocknet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtMocknet fadroma","devnet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtDevnet fadroma","testnet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtTestnet fadroma","mainnet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtMainnet fadroma"}}' > package.json
pnpm i
pnpm build
pnpm mocknet deploy
pnpm devnet deploy
pnpm devnet status
pnpm devnet export
pnpm devnet reset
cd ..
rm -rf testproject
# Here we test creating a project from a source checkout of Fadroma
# that has been pre-compiled to JavaScript using @hackbg/ubik
project-gh-compiled:
name: Create and build a project by compiled checkout
runs-on: ubuntu-latest
steps:
- name: Clone with submodules
uses: actions/checkout@v4
with: { submodules: recursive }
- name: Setup PNPM
uses: pnpm/action-setup@v2
with: { version: 7.29.1, run_install: false }
- name: Setup Node 19
uses: actions/setup-node@v3
with:
node-version: "19"
check-latest: true
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Setup Rust (stable, wasm32-unknown-unknown)
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.69.0
target: wasm32-unknown-unknown
override: true
- name: Build Fadroma to NPM equivalent
env:
FORCE_COLOR: 2
run: |
pnpm i # install with dev dependencies
pnpm exec ubik compile # compile to js, don't typecheck or run tests
sudo ln -s `which true` /usr/local/bin/husky # stub husky
pnpm i -P # remove dev dependencies
- name: Create project
env:
FORCE_COLOR: 2
run: |
sudo apt install -y wabt binaryen
export FADROMA="$(pwd)"
cd ..
npx ./fadroma create myproject mycontract1 mycontract2
cd myproject
cat package.json
echo '{"name":"myproject","main":"api.ts","type":"module","version":"0.1.0","dependencies":{"@fadroma/agent":"link:../fadroma/agent","@fadroma/scrt":"link:../fadroma/scrt"},"devDependencies":{"@hackbg/fadroma":"link:../fadroma","@hackbg/ganesha":"link:../fadroma/ensuite/ganesha","typescript":"^5"},"scripts":{"build":"fadroma build","status":"fadroma status","mocknet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtMocknet fadroma","devnet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtDevnet fadroma","testnet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtTestnet fadroma","mainnet":"FADROMA_PROJECT=./ops.ts FADROMA_CHAIN=ScrtMainnet fadroma"}}' > package.json
cat package.json
pnpm i --no-frozen-lockfile
cat fadroma.yml
cat api.ts
cat ops.ts
npm run build
npm run mocknet deploy
ls -al state
ls -al state/*
npm run devnet deploy
npm run devnet export
npm run devnet reset
cd ..
rm -rf myproject
# Here we test creating a project from the published NPM package.
# `npm/` tags are automatically pushed by `@hackbg/ubik` after publishing
# the packages to NPM for real, so this job only runs on tag pushes.
# TODO: Add retry in case NPM caches are slow to refresh after publication.
project-npm:
if: "startsWith(github.ref, 'refs/tags/npm/')"
name: Create and build a project by published package
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 20]
steps:
- name: Setup Node ${{matrix.node-version}}
uses: actions/setup-node@v3
with:
node-version: "${{matrix.node-version}}"
check-latest: true
- name: Setup Rust (stable, wasm32-unknown-unknown)
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: Create project through NPX
run: |
sudo apt install -y wabt binaryen
npx @hackbg/fadroma@latest create myproject mycontract1 mycontract2
cd myproject
cat package.json
cat fadroma.yml
cat api.ts
cat ops.ts
npm run build
npm run mocknet deploy
npm run devnet deploy
npm run devnet export
npm run devnet reset