Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplatform TS bindings test #1781

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ad2d398
Run ts tests on win/mac
Ifropc Dec 5, 2024
b1c8af4
docker test
Ifropc Dec 5, 2024
d2b2c6e
docker macos
Ifropc Dec 5, 2024
1fc00fe
quickstart in docker
Ifropc Dec 5, 2024
8b74c49
Fix typo
Ifropc Dec 5, 2024
0423e6c
Fix typo
Ifropc Dec 5, 2024
c5ca55b
fixes
Ifropc Dec 5, 2024
7be111a
inspect
Ifropc Dec 5, 2024
9aab5ce
fixes
Ifropc Dec 5, 2024
d1da372
fixes
Ifropc Dec 5, 2024
2888a09
wait for qs
Ifropc Dec 5, 2024
a577040
add docker logs and downgrade mac version
Ifropc Dec 5, 2024
90db73b
powershell...
Ifropc Dec 5, 2024
cfaffdf
tmp: remove health checks
Ifropc Dec 5, 2024
e95f840
add WSL
Ifropc Dec 10, 2024
4a992e5
i love windows
Ifropc Dec 10, 2024
8381dfa
trying ubuntu 22
Ifropc Dec 10, 2024
c9876a7
Ubuntu WSL action
Ifropc Dec 12, 2024
c832c2a
winget
Ifropc Dec 12, 2024
a05dd07
trying setup-wsl
Ifropc Dec 12, 2024
2bd979f
try wsl shell
Ifropc Dec 12, 2024
fd6b0b8
Win docker
Ifropc Dec 12, 2024
a61d36c
--yes
Ifropc Dec 12, 2024
89154d0
systemctl
Ifropc Dec 12, 2024
df5d4d8
repairing systemd
Ifropc Dec 12, 2024
4161abb
cleanup
Ifropc Dec 12, 2024
cbd26c6
Bring back the health check
Ifropc Dec 12, 2024
c04c0f5
windows tests
Ifropc Dec 13, 2024
c9890cb
Fixes
Ifropc Dec 13, 2024
afbf34c
small fix
Ifropc Dec 13, 2024
465275a
refactoring
Ifropc Dec 13, 2024
c35329d
windows...
Ifropc Dec 13, 2024
20f0326
fixes
Ifropc Dec 13, 2024
a8775f2
logs
Ifropc Dec 13, 2024
8ddb1e6
fix
Ifropc Dec 14, 2024
ef44032
Small fixes
Ifropc Dec 14, 2024
70ec673
win print health
Ifropc Dec 14, 2024
b11293b
adjust sleep scripts
Ifropc Dec 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 105 additions & 16 deletions .github/workflows/bindings-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,11 @@ on:
jobs:
test:
name: test generated libraries
runs-on: ubuntu-22.04
services:
rpc:
image: stellar/quickstart:testing
ports:
- 8000:8000
env:
ENABLE_LOGS: true
NETWORK: local
ENABLE_SOROBAN_RPC: true
options: >-
--health-cmd "curl --no-progress-meter --fail-with-body -X POST \"http://localhost:8000/soroban/rpc\" -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":8675309,\"method\":\"getNetwork\"}' && curl --no-progress-meter \"http://localhost:8000/friendbot\" | grep '\"invalid_field\": \"addr\"'"
--health-interval 10s
--health-timeout 5s
--health-retries 50
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest-16-cores, macos-13, windows-latest-8-cores]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
Expand All @@ -34,9 +24,108 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup docker (missing on MacOS)
if: runner.os == 'macos'
run: |
brew install docker
brew install colima
colima start
- name: Install wsl
if: runner.os == 'windows'
uses: vedantmgoyal9/setup-wsl2@4edf825c69cdaad7d6a852f57c9446f83fea8b91
# https://github.com/vedantmgoyal9/setup-wsl2/issues/3
- name: Enable systemd
if: runner.os == 'windows'
run: |
echo "[boot]
systemd=true" > /etc/wsl.conf
shell: wsl-run {0}
- name: Restart WSL
if: runner.os == 'windows'
run: |
Write-Output 'Restarting WSL...'
wsl --shutdown
# https://learn.microsoft.com/en-us/windows/wsl/wsl-config#the-8-second-rule-for-configuration-changes
# although the documentation says 8 seconds, we wait for 10 seconds to be safe
Start-Sleep -Seconds 10
- name: Install Docker
if: runner.os == 'windows'
run: |
systemctl list-unit-files --type=service

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install --yes ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install --yes docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker.socket
sudo systemctl start docker.service
sudo systemctl status docker.service
sudo docker run hello-world
shell: wsl-run {0}
- run: |
docker run -d --name quickstart -p 8000:8000 -e ENABLE_LOGS=true -e NETWORK=local -e ENABLE_SOROBAN_RPC=true --health-cmd "curl --no-progress-meter --fail-with-body -X POST \"http://localhost:8000/soroban/rpc\" -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":8675309,\"method\":\"getNetwork\"}' && curl --no-progress-meter \"http://localhost:8000/friendbot\" | grep '\"invalid_field\": \"addr\"'" --health-interval 10s --health-timeout 5s --health-retries 50 stellar/quickstart:testing
if: runner.os != 'windows'
shell: bash
- run: |
while true; do
status=`docker inspect -f {{.State.Health.Status}} quickstart`
echo "quickstart status: $status"
if [ "$status" == "healthy" ]; then
break
fi
sleep 1;
done;
if: runner.os != 'windows'
shell: bash
- run: |
docker run -d --name quickstart -p 8000:8000 -e ENABLE_LOGS=true -e NETWORK=local -e ENABLE_SOROBAN_RPC=true --health-cmd "curl --no-progress-meter --fail-with-body -X POST \"http://localhost:8000/soroban/rpc\" -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":8675309,\"method\":\"getNetwork\"}' && curl --no-progress-meter \"http://localhost:8000/friendbot\" | grep '\"invalid_field\": \"addr\"'" --health-interval 10s --health-timeout 5s --health-retries 50 stellar/quickstart:testing
if: runner.os == 'windows'
shell: wsl-run {0}
- run: |
while true; do
status=`docker inspect -f {{.State.Health.Status}} quickstart`
echo "quickstart status: $status"
if [ "$status" == "healthy" ]; then
break
fi
sleep 1;
done;
if: runner.os == 'windows'
shell: wsl-run {0}
- run: rustup update
- run: cargo build
- run: rustup target add wasm32-unknown-unknown
- run: make build-test-wasms
- run: npm ci && npm run test
- run: npm ci
if: runner.os != 'windows'
working-directory: cmd/crates/soroban-spec-typescript/ts-tests
- run: |
npm ci --ignore-scripts
cargo run --quiet -p stellar-cli -- keys generate root
cargo run --quiet -p stellar-cli -- keys fund root
$contract_id=(cargo run --quiet -p stellar-cli -- contract deploy --quiet --source root --wasm ../../../../target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm --ignore-checks)
cargo run --quiet -p stellar-cli -- contract bindings typescript --contract-id $contract_id --output-dir ./node_modules/test-custom-types --overwrite
cd ./node_modules/test-custom-types
npm install
npm run build
if: runner.os == 'windows'
working-directory: cmd/crates/soroban-spec-typescript/ts-tests
- run: npm run test
working-directory: cmd/crates/soroban-spec-typescript/ts-tests
- name: quickstart logs
if: always() && runner.os != 'windows'
run: docker logs quickstart
- name: quickstart logs
if: always() && runner.os == 'windows'
run: docker logs quickstart
shell: wsl-run {0}
Loading