Add an example deploy script to hello world example #901
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: Rust | |
on: | |
push: | |
branches: [main, dev] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }} | |
cancel-in-progress: true | |
env: | |
MINIMUM_RUST_VERSION: 1.74.0 | |
jobs: | |
complete: | |
if: always() | |
needs: [fmt, build-and-test] | |
runs-on: ubuntu-latest | |
steps: | |
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
run: exit 1 | |
dirs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- id: dirs | |
run: | | |
dirs=$(find . -type f -name 'Makefile' -mindepth 2 | xargs dirname | sed 's|^\./||' | jq -Rnc '[inputs | "\(.)"]') | |
echo "dirs=$dirs" >> $GITHUB_OUTPUT | |
outputs: | |
dirs: ${{ steps.dirs.outputs.dirs }} | |
fmt: | |
needs: dirs | |
strategy: | |
matrix: | |
working-directory: ${{ fromJSON(needs.dirs.outputs.dirs) }} | |
defaults: | |
run: | |
working-directory: ${{ matrix.working-directory }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rustup update | |
- run: cargo fmt --all --check | |
build-and-test: | |
needs: dirs | |
strategy: | |
matrix: | |
working-directory: ${{ fromJSON(needs.dirs.outputs.dirs) }} | |
rust: [msrv, latest] | |
sys: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
defaults: | |
run: | |
working-directory: ${{ matrix.working-directory }} | |
runs-on: ${{ matrix.sys.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: stellar/actions/rust-cache@main | |
- name: Use the minimum supported Rust version | |
if: matrix.rust == 'msrv' | |
run: | | |
rustup override set $MINIMUM_RUST_VERSION | |
rustup component add clippy --toolchain $MINIMUM_RUST_VERSION | |
- name: Error on warnings and clippy checks | |
# Only error on warnings and checks for the msrv, because new versions of | |
# Rust will frequently add new warnings and checks. | |
if: matrix.rust == 'msrv' | |
run: echo RUSTFLAGS='-Dwarnings' >> $GITHUB_ENV | |
- run: rustup update | |
- run: cargo version | |
- run: rustup target add ${{ matrix.sys.target }} | |
- run: rustup target add wasm32-unknown-unknown | |
- uses: stellar/binaries@v16 | |
with: | |
name: soroban-cli | |
version: 0.8.7 | |
- run: make test | |
env: | |
CARGO_BUILD_TARGET: ${{ matrix.sys.target }} |