Skip to content

Commit cacbfc1

Browse files
♻️ Refactor workspace and project dependencies (#15)
* ♻️ Refactor workspace and project dependencies * 👷 Update CI/CD workflows * 👷 Add workdflow to publish ts sdk on release * 🙈 Ignore yarn error log * ♻️ Use workspace dependencies for the CLI
1 parent 4661d15 commit cacbfc1

File tree

27 files changed

+422
-2765
lines changed

27 files changed

+422
-2765
lines changed

.github/workflows/publish-bolt-lang.yml renamed to .github/workflows/publish-bolt-crates.yml

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
name: Publish Bolt Lang
1+
name: Publish Bolt crates
22
on:
33
release:
44
types: [published]
55
workflow_dispatch:
66

77
env:
8-
solana_version: v1.17.0
8+
solana_version: v1.18.1
99
anchor_version: 0.29.0
1010

1111
jobs:
1212
install:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616

17-
- uses: actions/cache@v3
17+
- uses: actions/cache@v4
1818
name: cache solana cli
1919
id: cache-solana
2020
with:
@@ -23,14 +23,15 @@ jobs:
2323
~/.local/share/solana/
2424
key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
2525

26-
- uses: actions/setup-node@v3
26+
- uses: actions/setup-node@v4
2727
with:
2828
node-version: 20
2929

3030
- name: install essentials
3131
run: |
3232
sudo apt-get update
3333
sudo apt-get install -y pkg-config build-essential libudev-dev
34+
npm install --global yarn
3435
3536
- name: Cache node dependencies
3637
uses: actions/cache@v3
@@ -43,7 +44,8 @@ jobs:
4344
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
4445
yarn --frozen-lockfile --network-concurrency 2
4546
46-
- uses: dtolnay/rust-toolchain@stable
47+
- name: install rust
48+
uses: dtolnay/rust-toolchain@stable
4749
with:
4850
toolchain: stable
4951

@@ -62,7 +64,7 @@ jobs:
6264
runs-on: ubuntu-latest
6365

6466
steps:
65-
- uses: actions/checkout@v3
67+
- uses: actions/checkout@v4
6668
- name: Cache rust
6769
uses: Swatinem/rust-cache@v2
6870
- name: Run fmt
@@ -74,30 +76,38 @@ jobs:
7476
needs: install
7577
runs-on: ubuntu-latest
7678
steps:
77-
- uses: actions/checkout@v3
79+
- uses: actions/checkout@v4
7880
- name: Use Node ${{ matrix.node }}
79-
uses: actions/setup-node@v3
81+
uses: actions/setup-node@v4
8082
with:
8183
node-version: 20
8284

8385
- name: Cache node dependencies
84-
uses: actions/cache@v3
86+
uses: actions/cache@v4
8587
with:
8688
path: '**/node_modules'
8789
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
8890

8991
- name: Run lint
9092
run: yarn lint
9193

92-
test-and-publish:
94+
test:
9395
needs: [clippy-lint, yarn-lint]
9496
runs-on: ubuntu-latest
9597

9698
steps:
97-
- uses: actions/checkout@v3
99+
- name: install rust
100+
uses: dtolnay/rust-toolchain@stable
101+
with:
102+
toolchain: stable
103+
104+
- name: Cache rust
105+
uses: Swatinem/rust-cache@v2
106+
107+
- uses: actions/checkout@v4
98108

99109
- name: Use Node ${{ matrix.node }}
100-
uses: actions/setup-node@v3
110+
uses: actions/setup-node@v4
101111
with:
102112
node-version: 20
103113

@@ -111,7 +121,7 @@ jobs:
111121
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
112122
yarn --frozen-lockfile
113123
114-
- uses: actions/cache@v3
124+
- uses: actions/cache@v4
115125
name: cache solana cli
116126
id: cache-solana
117127
with:
@@ -138,10 +148,21 @@ jobs:
138148
echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
139149
echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
140150
151+
- name: run build
152+
run: |
153+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
154+
npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
155+
solana-test-validator > /dev/null &
156+
sleep 5
157+
solana airdrop -u l 100 tEsT3eV6RFCWs1BZ7AXTzasHqTtMnMLCB2tjQ42TDXD
158+
anchor build
159+
anchor idl build
160+
anchor deploy
161+
pkill -9 -f solana-test-validator
162+
141163
- name: run tests
142164
run: |
143165
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
144-
ls node_modules/.bin
145166
npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
146167
anchor test
147168
@@ -150,7 +171,10 @@ jobs:
150171
cargo publish --manifest-path=crates/bolt-lang/attribute/account/Cargo.toml --token ${CRATES_TOKEN}
151172
cargo publish --manifest-path=crates/bolt-lang/attribute/component/Cargo.toml --token ${CRATES_TOKEN}
152173
cargo publish --manifest-path=crates/bolt-lang/attribute/component-deserialize/Cargo.toml --token ${CRATES_TOKEN}
174+
cargo publish --manifest-path=crates/bolt-lang/attribute/component-id/Cargo.toml --token ${CRATES_TOKEN}
153175
cargo publish --manifest-path=crates/bolt-lang/attribute/system/Cargo.toml --token ${CRATES_TOKEN}
176+
cargo publish --manifest-path=crates/bolt-lang/attribute/system-input/Cargo.toml --token ${CRATES_TOKEN}
177+
cargo publish --manifest-path=crates/bolt-lang/attribute/bolt-program/Cargo.toml --token ${CRATES_TOKEN}
154178
cargo publish --manifest-path=programs/bolt-system/Cargo.toml --token ${CRATES_TOKEN}
155179
cargo publish --manifest-path=programs/bolt-component/Cargo.toml --token ${CRATES_TOKEN}
156180
cargo publish --manifest-path=programs/world/Cargo.toml --token ${CRATES_TOKEN}
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: Publish Bolt SDKs
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
7+
env:
8+
solana_version: v1.18.1
9+
anchor_version: 0.29.0
10+
11+
jobs:
12+
install:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/cache@v4
18+
name: cache solana cli
19+
id: cache-solana
20+
with:
21+
path: |
22+
~/.cache/solana/
23+
~/.local/share/solana/
24+
key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
30+
- name: install essentials
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y pkg-config build-essential libudev-dev
34+
npm install --global yarn
35+
36+
- name: Cache node dependencies
37+
uses: actions/cache@v3
38+
with:
39+
path: '**/node_modules'
40+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
41+
42+
- name: install node_modules
43+
run: |
44+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
45+
yarn --frozen-lockfile --network-concurrency 2
46+
47+
- name: install rust
48+
uses: dtolnay/rust-toolchain@stable
49+
with:
50+
toolchain: stable
51+
52+
- name: Cache rust
53+
uses: Swatinem/rust-cache@v2
54+
55+
- name: install solana
56+
if: steps.cache-solana.outputs.cache-hit != 'true'
57+
run: |
58+
sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
59+
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
60+
solana --version
61+
62+
clippy-lint:
63+
needs: install
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
- name: Cache rust
69+
uses: Swatinem/rust-cache@v2
70+
- name: Run fmt
71+
run: cargo fmt -- --check
72+
- name: Run clippy
73+
run: cargo clippy -- --deny=warnings
74+
75+
yarn-lint:
76+
needs: install
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: actions/checkout@v4
80+
- name: Use Node ${{ matrix.node }}
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: 20
84+
85+
- name: Cache node dependencies
86+
uses: actions/cache@v4
87+
with:
88+
path: '**/node_modules'
89+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
90+
91+
- name: Run lint
92+
run: yarn lint
93+
94+
test:
95+
needs: [clippy-lint, yarn-lint]
96+
runs-on: ubuntu-latest
97+
98+
steps:
99+
- name: install rust
100+
uses: dtolnay/rust-toolchain@stable
101+
with:
102+
toolchain: stable
103+
104+
- name: Cache rust
105+
uses: Swatinem/rust-cache@v2
106+
107+
- uses: actions/checkout@v4
108+
109+
- name: Use Node ${{ matrix.node }}
110+
uses: actions/setup-node@v4
111+
with:
112+
node-version: 20
113+
114+
- name: Cache node dependencies
115+
uses: actions/cache@v3
116+
with:
117+
path: '**/node_modules'
118+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
119+
- name: install node_modules
120+
run: |
121+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
122+
yarn --frozen-lockfile
123+
124+
- uses: actions/cache@v4
125+
name: cache solana cli
126+
id: cache-solana
127+
with:
128+
path: |
129+
~/.cache/solana/
130+
~/.local/share/solana/
131+
key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
132+
133+
- name: setup solana
134+
run: |
135+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
136+
solana --version
137+
solana-keygen new --silent --no-bip39-passphrase
138+
139+
- name: Set deployments keys
140+
run: |
141+
mkdir -p target/deploy
142+
echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
143+
echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
144+
echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
145+
echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
146+
echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
147+
echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
148+
echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
149+
echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
150+
151+
- name: run build
152+
run: |
153+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
154+
npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
155+
solana-test-validator > /dev/null &
156+
sleep 5
157+
solana airdrop -u l 100 tEsT3eV6RFCWs1BZ7AXTzasHqTtMnMLCB2tjQ42TDXD
158+
anchor build
159+
anchor idl build
160+
anchor deploy
161+
pkill -9 -f solana-test-validator
162+
163+
- name: run tests
164+
run: |
165+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
166+
npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
167+
anchor test
168+
169+
- name: npm publish
170+
run: |
171+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
172+
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
173+
cd clients/bolt-sdk/ && yarn build && yarn lint:fix && cd ../../ && yarn lint:fix
174+
cd clients/bolt-sdk/ && npm publish
175+
env:
176+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/run-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Run Bolt Tests
22
on:
3-
push:
43
pull_request:
54

65
env:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target
66
**/*.rs.bk
77
node_modules
88
clients/sdk/node_modules
9-
test-ledger
9+
clients/bolt-sdk/yarn-error.log
1010
.yarn
1111
**/test-ledger
1212

@@ -16,3 +16,4 @@ tests/examples/target
1616
tests/examples/node_modules
1717
tests/examples/.yarn
1818

19+

Cargo.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,44 @@ members = [
66
"crates/*",
77
]
88

9+
[workspace.package]
10+
version = "0.0.1"
11+
authors = ["Magicblock Labs <[email protected]>"]
12+
repository = "https://github.com/magicblock-labs/bolt"
13+
homepage = "https://www.magicblock.gg/"
14+
license = "MIT"
15+
edition = "2021"
16+
17+
[workspace.dependencies]
18+
bolt-attribute-bolt-program = { path = "crates/bolt-lang/attribute/bolt-program", version = "=0.0.1" }
19+
bolt-attribute-bolt-component = { path = "crates/bolt-lang/attribute/component", version = "=0.0.1" }
20+
bolt-attribute-bolt-system = { path = "crates/bolt-lang/attribute/system", version = "=0.0.1"}
21+
bolt-attribute-bolt-system-input = { path = "crates/bolt-lang/attribute/system-input", version = "=0.0.1" }
22+
bolt-attribute-bolt-component-deserialize = { path = "crates/bolt-lang/attribute/component-deserialize", version = "=0.0.1" }
23+
bolt-attribute-bolt-component-id = { path = "crates/bolt-lang/attribute/component-id", version = "=0.0.1" }
24+
world = { path = "programs/world", features = ["cpi"], version = "=0.0.1"}
25+
bolt-system = { path = "programs/bolt-system", features = ["cpi"], version = "=0.0.1"}
26+
27+
## External crates
28+
anchor-lang = "0.29.0"
29+
solana-security-txt = "1.1.1"
30+
tuple-conv = "1.0.1"
31+
syn = { version = "1.0.60", features = ["full"] }
32+
quote = "1.0"
33+
proc-macro2 = "1.0"
34+
serde = { version = "1.0", features = ["derive"] }
35+
serde_json = "1.0"
36+
anyhow = "1.0.32"
37+
heck = "0.4.0"
38+
clap = { version = "4.2.4", features = ["derive"] }
39+
# TODO: Remove once https://github.com/solana-labs/solana/issues/33504 is resolved.
40+
ahash = "=0.8.6"
41+
942
[profile.release]
1043
overflow-checks = true
1144
lto = "fat"
1245
codegen-units = 1
46+
1347
[profile.release.build-override]
1448
opt-level = 3
1549
incremental = false

0 commit comments

Comments
 (0)