diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..742ad5b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: ci + +on: + push: + branches: + - main + pull_request: + branches: + - "**" + +jobs: + build: + name: Lint CLI + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + sparse-checkout: | + clients/cli + proto + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + + - name: Install protoc + uses: arduino/setup-protoc@v3 + + - name: Set up Rust cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: ./clients/cli + + - name: Build CLI + working-directory: clients/cli + run: | + cargo build --profile=ci-build + + - name: Run cargo clippy on Orchestrator + working-directory: clients/cli + run: | + cargo clippy --profile=ci-build --no-deps --all-targets --workspace -- -D warnings + + - name: Test + working-directory: clients/cli + run: | + cargo test --profile=ci-build --tests + + - name: Ensure checked in generated files are up to date + run: | + if [ -n "$(git status --porcelain)" ]; then \ + echo "There are uncommitted changes in working tree after building."; \ + git status; \ + git --no-pager diff; \ + exit 1; \ + else \ + echo "Git working tree is clean"; \ + fi; diff --git a/proto/generate_protobufs.sh b/proto/generate_protobufs.sh deleted file mode 100755 index a8015ca..0000000 --- a/proto/generate_protobufs.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -mkdir -p clients/flutter/lib/src/generated -protoc --experimental_allow_proto3_optional --dart_out=grpc:clients/flutter/lib/src/generated -Iproto proto/orchestrator.proto -dart format clients/flutter/lib/src/generated -(cd clients/dummy_client && cargo build || echo clients/dummy_client not found, possibly due to a sparse checkout.) -(cd clients/cli && cargo build || echo clients/cli not found, possibly due to a sparse checkout.) -(cd orchestrator && cargo build || echo orchestrator/ not found, possibly due a sparse checkout.)