chore: Add test runner #9
This file contains hidden or 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: Build and Test | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - run: rustup target add wasm32-unknown-unknown | |
| # - run: sudo apt install libdbus-1-dev pkg-config # required for stellar-scaffold to build | |
| - run: sudo apt-get update && sudo apt-get install -y libudev-dev | |
| - name: Set PKG_CONFIG_PATH | |
| run: echo "PKG_CONFIG_PATH=/usr/lib/pkgconfig" >> $GITHUB_ENV | |
| - name: Install stellar-scaffold from git | |
| uses: baptiste0928/cargo-install@v3 | |
| with: | |
| crate: stellar-scaffold-cli | |
| git: https://github.com/ahalabs/scaffold-stellar | |
| branch: main | |
| - name: Build clients before building the project | |
| run: STELLAR_SCAFFOLD_ENV=development stellar-scaffold build --build-clients | |
| - run: npm run build | |
| - name: Run tests | |
| run: npm test --if-present |