| 1 | name: OpenHarmony |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | workflow_call: |
| 6 | |
| 7 | permissions: |
| 8 | contents: read |
| 9 | |
| 10 | concurrency: |
| 11 | group: ohos-${{ github.event.pull_request.number || github.ref }} |
| 12 | cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 13 | |
| 14 | env: |
| 15 | CARGO_TERM_COLOR: always |
| 16 | CARGO_INCREMENTAL: 0 |
| 17 | RUSTFLAGS: -Dwarnings |
| 18 | |
| 19 | jobs: |
| 20 | cargo-check: |
| 21 | name: cargo check (aarch64-unknown-linux-ohos) |
| 22 | runs-on: ubuntu-24.04 |
| 23 | timeout-minutes: 45 |
| 24 | steps: |
| 25 | - uses: actions/checkout@v7 |
| 26 | - name: Install Rust target |
| 27 | uses: dtolnay/rust-toolchain@1.100.0 |
| 28 | with: |
| 29 | targets: aarch64-unknown-linux-ohos |
| 30 | - name: Install OpenHarmony native SDK |
| 31 | id: ohos-sdk |
| 32 | # Pin the action: it downloads a published OpenHarmony SDK and verifies |
| 33 | # the archive checksum. This job must never substitute host headers or |
| 34 | # a stub sysroot and report that as target support. |
| 35 | uses: openharmony-rs/setup-ohos-sdk@b312caf8a43bb836aa24c08f65f97e1f09a89cad |
| 36 | with: |
| 37 | version: '6.1' |
| 38 | components: native |
| 39 | # Save the ~715 MB SDK cache from main only. The action has no |
| 40 | # restore-only mode, and with `cache: true` every PR ref that missed |
| 41 | # main's entry saved its own 715 MB copy; a handful of open PRs |
| 42 | # pushed the repo past the 10 GiB Actions cache cap and evicted the |
| 43 | # Rust caches CI actually depends on. PRs download the SDK instead |
| 44 | # (checksum-verified from the GitHub mirror below). |
| 45 | cache: ${{ github.ref == 'refs/heads/main' }} |
| 46 | mirror: true |
| 47 | - name: Check Codewhale TUI and CLI with the real SDK/sysroot |
| 48 | shell: bash |
| 49 | env: |
| 50 | OHOS_NATIVE_SDK: ${{ steps.ohos-sdk.outputs.ohos_sdk_native }} |
| 51 | run: | |
| 52 | set -euo pipefail |
| 53 | test -x "${OHOS_NATIVE_SDK}/llvm/bin/clang" |
| 54 | test -d "${OHOS_NATIVE_SDK}/sysroot" |
| 55 | . ./scripts/ohos/ohos-env.sh |
| 56 | cargo check --target aarch64-unknown-linux-ohos -p codewhale-tui -p codewhale-cli --locked |
| 57 |