Skip to content

Soroban/encode decode arrays #7610

Soroban/encode decode arrays

Soroban/encode decode arrays #7610

Workflow file for this run

name: Build tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
env:
LLVM_PROFILE_FILE: ${{ github.workspace }}/target/solang-%p-%10m.profraw
jobs:
docs:
name: Docs
runs-on: solang-ubuntu-latest
steps:
- name: Install Python and git
run: |
sudo apt-get update
sudo apt-get install -y python3-pip git pkg-config libcairo-dev latexmk meson
- name: Checkout sources
uses: actions/checkout@v4
with:
# docs/conf.py uses `git describe --tags` which requires full history.
fetch-depth: 0
- name: Build docs
working-directory: ./docs
run: |
# Without the --add safe.directory we get the following error:
# fatal: detected dubious ownership in repository at '/__w/solang/solang'
# actions/checkout@v4 is supposed to fix this, but it does not work.
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
pip install -r requirements.txt
make html epub
linux-x86-64:
name: Linux x86-64
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-7
env:
RUSTFLAGS: -C instrument-coverage -C llvm-args=--instrprof-atomic-counter-update-all --cfg=coverage --cfg=trybuild_no_target
CARGO_INCREMENTAL: 0
CARGO_LLVM_COV: 1
CARGO_LLVM_COV_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.90.0
components: |
llvm-tools
clippy
rustfmt
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run cargo clippy
run: cargo clippy --workspace --lib --bins -- -D warnings
- name: Run Soroban test clippy
run: cargo clippy -p solang --all-features --test soroban -- -D warnings
- name: Run cargo clippy without wasm_opt feature
run: cargo clippy --workspace --no-default-features --features language_server,llvm,soroban --bins -- -D warnings
- name: Run cargo clippy without llvm feature
run: cargo clippy --workspace --no-default-features --lib -- -D warnings
- name: Run cargo clippy with only soroban feature
run: cargo clippy --workspace --no-default-features --features soroban,llvm --lib -- -D warnings
- name: Run cargo doc
run: cargo doc --workspace --bins
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Configure llvm-cov and build
if: always()
run: |
cargo llvm-cov clean --workspace
cargo build
- name: Run library and binary tests
if: always()
run: cargo llvm-cov --all-features --workspace --lib --bins --no-report --jobs 2
- name: Run Soroban Rust tests
if: always()
run: cargo llvm-cov --all-features --test soroban --no-report --jobs 2
- name: Upload binary
uses: actions/upload-artifact@v4.4.0
with:
name: solang-linux-x86-64
path: ./target/debug/solang
- name: Compress test coverage files
run: |
rm -rf bpf wasm tmp cxxbridge CACHEDIR.TAG
rm -rf debug/build debug/deps debug/examples debug/incremental
tar -czvf rust-tests.tar.gz *
working-directory: ./target
- name: Upload test coverage files
uses: actions/upload-artifact@v4.4.0
with:
name: rust-tests.tar.gz
path: ./target/rust-tests.tar.gz
soroban:
name: Soroban Integration test
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-7
env:
SSL_CERT_FILE: /etc/ssl/certs/ca-certificates.crt
needs: linux-x86-64
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
- uses: dtolnay/rust-toolchain@1.90.0
with:
target: wasm32-unknown-unknown
- uses: actions/download-artifact@v4.1.8
with:
name: solang-linux-x86-64
path: bin
- name: Solang Compiler
run: |
chmod 755 ./bin/solang
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Install system dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates curl openssl libdbus-1-dev pkg-config
update-ca-certificates
- name: Install Stellar CLI
run: cargo install --locked stellar-cli --version 23.0.0
- name: Add wasm32v1-none target
run: rustup target add wasm32v1-none
- name: Add cargo install location to PATH
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- run: npm install
working-directory: ./integration/soroban
- name: Build Solang contracts
run: npm run build
working-directory: ./integration/soroban
- name: Build Rust contracts
run: stellar contract build --profile release-with-logs
working-directory: ./integration/soroban/rust/contracts
- name: Setup Soroban environment
run: npm run setup
working-directory: ./integration/soroban
- name: Deploy and test contracts
run: npm run test
working-directory: ./integration/soroban
- name: Upload test coverage files
uses: actions/upload-artifact@v4.4.0
with:
name: soroban-tests
path: ./target/*.profraw
std-lib-tests:
name: Stdlib
runs-on: solang-ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Lints for stdlib
run: make lint
working-directory: ./stdlib
- name: Stdlib tests
run: |
make test
./test
working-directory: ./stdlib
vscode:
name: Visual Code Extension
runs-on: solang-ubuntu-latest
needs: linux-x86-64
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4.1.8
with:
name: solang-linux-x86-64
path: bin
- run: |
chmod 755 ./bin/solang
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '>=18.17'
- run: npm install
working-directory: ./vscode
- run: npm run compile
working-directory: ./vscode
- name: Run headless test
run: xvfb-run npm test
working-directory: ./vscode
- run: npm install -g vsce
working-directory: ./vscode
- run: vsce package
working-directory: ./vscode
- name: Upload test coverage files
uses: actions/upload-artifact@v4.4.0
with:
name: vscode-tests
path: ./target/*.profraw
coverage:
name: Coverage report
runs-on: ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-7
needs: [linux-x86-64, soroban, vscode]
env:
RUSTFLAGS: -C instrument-coverage -C llvm-args=--instrprof-atomic-counter-update-all --cfg=coverage --cfg=trybuild_no_target
CARGO_INCREMENTAL: 0
CARGO_LLVM_COV: 1
CARGO_LLVM_COV_TARGET_DIR: ${{ github.workspace }}/target
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.90.0
components: llvm-tools
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Download Rust coverage files
uses: actions/download-artifact@v4.1.8
with:
name: rust-tests.tar.gz
path: ./target
- name: Download Soroban coverage files
uses: actions/download-artifact@v4.1.8
with:
name: soroban-tests
path: ./target
- name: Download VS Code coverage files
uses: actions/download-artifact@v4.1.8
with:
name: vscode-tests
path: ./target
- name: Unpack test coverage files
run: tar -xf rust-tests.tar.gz
working-directory: ./target
- name: Generate code report
run: cargo llvm-cov report --lcov --output-path lcov.info
- name: Upload coverage report to codecov.io
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: false
container:
name: Container Image
runs-on: solang-ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
permissions:
contents: read
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker buildx build . \
--push \
--tag ghcr.io/${GITHUB_REPOSITORY}:latest \
--label org.opencontainers.image.description="Solidity Compiler for Soroban version $(git describe --tags)"