Skip to content

Commit 939ffad

Browse files
authored
solana: fix idl build (#16)
* solana: fix idl build workflows: remove rustup default * solana: update Makefile --------- Co-authored-by: A5 Pickle <[email protected]>
1 parent 646bc03 commit 939ffad

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

.github/workflows/solana.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ jobs:
5959
node-version: "20.11.0"
6060
solana-cli-version: "1.18.15"
6161
anchor-version: "0.30.1"
62-
- name: Set default Rust toolchain
63-
run: rustup default stable
64-
working-directory: ./solana
62+
# - name: Set default Rust toolchain
63+
# run: rustup default stable
64+
# working-directory: ./solana
6565
- name: make check-idl
6666
run: make check-idl
6767
working-directory: ./solana
@@ -80,9 +80,9 @@ jobs:
8080
node-version: "20.11.0"
8181
solana-cli-version: "1.18.15"
8282
anchor-version: "0.30.1"
83-
- name: Set default Rust toolchain
84-
run: rustup default stable
85-
working-directory: ./solana
83+
# - name: Set default Rust toolchain
84+
# run: rustup default stable
85+
# working-directory: ./solana
8686
- name: make anchor-test
8787
run: make anchor-test
8888
working-directory: ./solana
@@ -101,9 +101,9 @@ jobs:
101101
node-version: "20.11.0"
102102
solana-cli-version: "1.18.15"
103103
anchor-version: "0.30.1"
104-
- name: Set default Rust toolchain
105-
run: rustup default stable
106-
working-directory: ./solana
104+
# - name: Set default Rust toolchain
105+
# run: rustup default stable
106+
# working-directory: ./solana
107107
- name: make anchor-test-upgrade
108108
run: make anchor-test-upgrade
109109
working-directory: ./solana

solana/Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ CLONED_MAINNET_PROGRAMS=\
77
ts/tests/artifacts/mainnet_cctp_token_messenger_minter.so \
88
ts/tests/artifacts/mainnet_cctp_message_transmitter.so
99

10+
PROGRAM_NAMES=matching_engine token_router upgrade_manager
11+
12+
### Building the IDL requires a nightly build. We arbitrarily chose the same
13+
### date as the release of Anchor 0.30.1.
14+
IDL_TOOLCHAIN=nightly-2024-06-20
15+
1016
.PHONY: all
1117
all: check
1218

@@ -42,11 +48,15 @@ endif
4248

4349
.PHONY: anchor-test-setup
4450
anchor-test-setup: node_modules ts/tests/artifacts $(CLONED_MAINNET_PROGRAMS)
45-
anchor build -- --features integration-test
51+
anchor build --no-idl -- --features integration-test
4652

4753
.PHONY: idl
4854
idl:
49-
anchor build -- --features localnet
55+
mkdir -p target/idl target/types
56+
for program in $(PROGRAM_NAMES); do \
57+
RUSTUP_TOOLCHAIN=$(IDL_TOOLCHAIN) anchor idl build -p $$program -o target/idl/$$program.json; \
58+
anchor idl type -o target/types/$$program.ts target/idl/$$program.json; \
59+
done
5060
mkdir -p ts/src/idl/json
5161
mkdir -p ts/src/idl/ts
5262
cp -r target/idl/* ts/src/idl/json/
@@ -65,7 +75,7 @@ anchor-test: anchor-test-setup
6575

6676
.PHONY: anchor-test-upgrade
6777
anchor-test-upgrade: node_modules ts/tests/artifacts $(CLONED_MAINNET_PROGRAMS)
68-
anchor build -- --features testnet
78+
anchor build --no-idl -- --features testnet
6979
cp target/deploy/matching_engine.so ts/tests/artifacts/new_testnet_matching_engine.so
7080
cp target/deploy/token_router.so ts/tests/artifacts/new_testnet_token_router.so
7181
cp target/deploy/upgrade_manager.so ts/tests/artifacts/testnet_upgrade_manager.so

0 commit comments

Comments
 (0)