[CI+GraphQL] Download Sui binary for localnet running in the CI + have tests only run on localnet #720
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: [cron: "40 1 * * *"] | |
permissions: | |
contents: read | |
env: | |
RUSTFLAGS: -Dwarnings | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: # we need this postgres instance for running a local network with indexer and graphql | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgrespw | |
POSTGRES_DB: sui_indexer_v2 | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: rust version | |
run: | | |
rustc --version | |
cargo --version | |
- uses: taiki-e/install-action@cargo-hack | |
- uses: taiki-e/install-action@cargo-nextest | |
- name: feature compatibility | |
run: make check-features | |
- name: rustfmt | |
run: make check-fmt | |
- name: clippy | |
run: make clippy | |
- name: Run tests that do not require local network | |
run: make test | |
- name: Get releases JSON file | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
curl \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-L -o releases.json \ | |
https://api.github.com/repos/MystenLabs/sui/releases | |
- name: Get the latest Sui testnet binary and start a local network | |
shell: bash | |
run: | | |
os=${{runner.os}} | |
binary_os="" | |
if [ $os == "Linux" ]; then | |
binary_os="ubuntu" | |
fi | |
testnet_url=$(cat releases.json | jq --arg os $binary_os '.[] | .assets[] | select(.name | contains("testnet")) | select(.name | contains($os)) | select(.name | contains("x86"))'| jq -csr '.[0] | .browser_download_url') | |
filename="sui-$binary_os.tar.gz" | |
echo "Downloading testnet binary from $testnet_url" | |
wget -q $testnet_url -O $filename | |
tar -zxvf $filename ./sui | |
./sui start --force-regenesis --with-faucet --with-indexer --with-graphql --pg-port 5432 --pg-db-name sui_indexer_v2 --epoch-duration-ms 10000 & | |
- name: Run tests that require local network | |
run: | | |
make test-with-localnet | |
- name: rustdoc | |
run: make doc | |
wasm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: rust version | |
run: | | |
rustc --version | |
cargo --version | |
- uses: taiki-e/install-action@wasm-pack | |
- name: Install clang | |
run: sudo apt-get install -y clang | |
- name: Run tests in wasm | |
run: make wasm |