| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | pull_request: |
| 6 | workflow_dispatch: |
| 7 | |
| 8 | permissions: |
| 9 | contents: read |
| 10 | |
| 11 | concurrency: |
| 12 | group: ci-${{ github.workflow }}-${{ github.ref }} |
| 13 | cancel-in-progress: true |
| 14 | |
| 15 | env: |
| 16 | CARGO_TERM_COLOR: always |
| 17 | |
| 18 | jobs: |
| 19 | fmt: |
| 20 | name: Format |
| 21 | runs-on: ubuntu-latest |
| 22 | steps: |
| 23 | - name: Checkout |
| 24 | uses: actions/checkout@v6 |
| 25 | |
| 26 | - name: Install Rust toolchain |
| 27 | uses: dtolnay/rust-toolchain@stable |
| 28 | with: |
| 29 | components: rustfmt |
| 30 | |
| 31 | - name: Check formatting |
| 32 | run: cargo fmt -- --check |
| 33 | |
| 34 | clippy: |
| 35 | name: Clippy |
| 36 | runs-on: ubuntu-latest |
| 37 | steps: |
| 38 | - name: Checkout |
| 39 | uses: actions/checkout@v6 |
| 40 | |
| 41 | - name: Install Rust toolchain |
| 42 | uses: dtolnay/rust-toolchain@stable |
| 43 | with: |
| 44 | components: clippy |
| 45 | |
| 46 | - name: Install system dependencies |
| 47 | run: sudo apt-get install -y libclang-dev |
| 48 | |
| 49 | - name: Cache cargo registry and build artifacts |
| 50 | uses: Swatinem/rust-cache@v2 |
| 51 | |
| 52 | - name: Lint |
| 53 | run: cargo clippy --all-targets -- -D warnings |
| 54 | env: |
| 55 | ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }} |
| 56 | ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }} |
| 57 | GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }} |
| 58 | GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }} |
| 59 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 60 | |
| 61 | test: |
| 62 | name: Test |
| 63 | runs-on: ubuntu-latest |
| 64 | steps: |
| 65 | - name: Checkout |
| 66 | uses: actions/checkout@v6 |
| 67 | |
| 68 | - name: Install Rust toolchain |
| 69 | uses: dtolnay/rust-toolchain@stable |
| 70 | |
| 71 | - name: Install system dependencies |
| 72 | run: sudo apt-get install -y libclang-dev |
| 73 | |
| 74 | - name: Cache cargo registry and build artifacts |
| 75 | uses: Swatinem/rust-cache@v2 |
| 76 | |
| 77 | - name: Run tests |
| 78 | run: cargo test --locked --verbose |
| 79 | env: |
| 80 | ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }} |
| 81 | ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }} |
| 82 | GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }} |
| 83 | GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }} |
| 84 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 85 | |
| 86 | check: |
| 87 | name: Cargo check |
| 88 | runs-on: ubuntu-latest |
| 89 | steps: |
| 90 | - name: Checkout |
| 91 | uses: actions/checkout@v6 |
| 92 | |
| 93 | - name: Install Rust toolchain |
| 94 | uses: dtolnay/rust-toolchain@stable |
| 95 | |
| 96 | - name: Install system dependencies |
| 97 | run: sudo apt-get install -y libclang-dev |
| 98 | |
| 99 | - name: Cache cargo registry and build artifacts |
| 100 | uses: Swatinem/rust-cache@v2 |
| 101 | |
| 102 | - name: Cargo check |
| 103 | run: cargo check --locked |
| 104 | env: |
| 105 | ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }} |
| 106 | ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }} |
| 107 | GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }} |
| 108 | GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }} |
| 109 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 110 | |
| 111 | dotnet-tool: |
| 112 | name: .NET tool launcher build |
| 113 | runs-on: ubuntu-latest |
| 114 | steps: |
| 115 | - name: Checkout |
| 116 | uses: actions/checkout@v6 |
| 117 | |
| 118 | - name: Setup .NET SDK |
| 119 | uses: actions/setup-dotnet@v4 |
| 120 | with: |
| 121 | dotnet-version: 8.0.x |
| 122 | |
| 123 | - name: Build .NET tool launcher |
| 124 | run: dotnet build nuget/onde-cli/Onde.Cli.csproj --configuration Release |
| 125 | |
| 126 | dart-package: |
| 127 | name: Dart pub package check |
| 128 | runs-on: ubuntu-latest |
| 129 | steps: |
| 130 | - name: Checkout |
| 131 | uses: actions/checkout@v6 |
| 132 | |
| 133 | - name: Setup Dart SDK |
| 134 | uses: dart-lang/setup-dart@v1 |
| 135 | |
| 136 | - name: Get package dependencies |
| 137 | working-directory: pub/onde_cli |
| 138 | run: dart pub get |
| 139 | |
| 140 | - name: Analyze Dart package |
| 141 | working-directory: pub/onde_cli |
| 142 | run: dart analyze |
| 143 | |
| 144 | build: |
| 145 | name: Build (aarch64-apple-darwin) |
| 146 | runs-on: macos-26 |
| 147 | steps: |
| 148 | - name: Checkout |
| 149 | uses: actions/checkout@v6 |
| 150 | |
| 151 | - name: Install Rust toolchain |
| 152 | uses: dtolnay/rust-toolchain@stable |
| 153 | with: |
| 154 | targets: aarch64-apple-darwin |
| 155 | |
| 156 | - name: Cache cargo registry and build artifacts |
| 157 | uses: Swatinem/rust-cache@v2 |
| 158 | |
| 159 | - name: Build release binary |
| 160 | run: cargo build --release --locked --target aarch64-apple-darwin |
| 161 | env: |
| 162 | ONDE_APP_ID: ${{ secrets.ONDE_APP_ID }} |
| 163 | ONDE_APP_SECRET: ${{ secrets.ONDE_APP_SECRET }} |
| 164 | GRESIQ_API_KEY: ${{ secrets.GRESIQ_API_KEY }} |
| 165 | GRESIQ_API_SECRET: ${{ secrets.GRESIQ_API_SECRET }} |
| 166 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 167 | |
| 168 | ci: |
| 169 | name: CI status |
| 170 | runs-on: ubuntu-latest |
| 171 | needs: |
| 172 | - fmt |
| 173 | - clippy |
| 174 | - test |
| 175 | - check |
| 176 | - dotnet-tool |
| 177 | - dart-package |
| 178 | - build |
| 179 | if: always() |
| 180 | steps: |
| 181 | - name: Verify all required jobs succeeded |
| 182 | run: | |
| 183 | test "${{ needs.fmt.result }}" = "success" |
| 184 | test "${{ needs.clippy.result }}" = "success" |
| 185 | test "${{ needs.test.result }}" = "success" |
| 186 | test "${{ needs.check.result }}" = "success" |
| 187 | test "${{ needs.dotnet-tool.result }}" = "success" |
| 188 | test "${{ needs.dart-package.result }}" = "success" |
| 189 | test "${{ needs.build.result }}" = "success" |