/
githubmirror
/
servo
Обзор
Документация
Войти
/
githubmirror
/
servo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/ohos.yml
442 строки
20 KB
Euclid Ye
ci: Fix ohos bencher error by reverting to `actions/checkout` (#46768)
25 июл 2026, 08:57
Не верифицирован
25 июл 2026, 08:57
ce5ba5e
Код
Авторство
О чём код?
name: OpenHarmony on: workflow_call: inputs: profile: required: false default: "checked-release" type: string upload_library: required: false default: false type: boolean bencher: required: false default: false type: boolean outputs: artifact_ids: value: ${{ jobs.build-openharmony.outputs.artifact_ids }} description: Comma-separated list of artifact IDs for the release artifacts optional_job_status: description: "Status of optional jobs (as an object)" value: ${{ jobs.collect-job-results.outputs.collected_job_status }} workflow_dispatch: inputs: profile: required: false default: "checked-release" type: choice description: "Cargo build profile" options: ["checked-release", "release", "debug", "production"] bencher: required: false default: false type: boolean env: RUST_BACKTRACE: 1 SHELL: /bin/bash CARGO_INCREMENTAL: 0 BENCHER_PROJECT: ${{ vars.BENCHER_PROJECT || 'servo' }} HITRACE_BENCH_VERSION: 0.11.1 PYTHONUNBUFFERED: 1 MITMDUMP_CACHE_KEY: mitmdump-ohos-cache-0.1 jobs: build-openharmony: name: OpenHarmony Build timeout-minutes: 60 runs-on: ubuntu-24.04 strategy: matrix: target: ["aarch64-unknown-linux-ohos", "x86_64-unknown-linux-ohos"] outputs: artifact_ids: ${{ steps.artifact_ids.outputs.artifact_ids }} signed: ${{ steps.signing_config.outputs.signed }} steps: - uses: servo/ci-runners/actions/checkout@a05e7e830e3f4d4c71bdc5a38f003f052b72668c - name: Install crown run: cargo install --path support/crown - name: Setup Python uses: ./.github/actions/setup-python - name: Change Mirror Priorities uses: ./.github/actions/apt-mirrors - name: Bootstrap dependencies timeout-minutes: 30 run: sudo apt update && ./mach bootstrap --yes --skip-lints --skip-nextest - name: Setup OpenHarmony SDK id: setup_sdk uses: openharmony-rs/setup-ohos-sdk@v1.0.0 with: version: "6.0.0.1" # api 20 in openharmony fixup-path: true - name: Install node for hvigor uses: actions/setup-node@v6 with: node-version: 24 - name: Install hvigor modules run: | mkdir ~/hvigor-installation cd ~/hvigor-installation echo "@ohos:registry=https://repo.harmonyos.com/npm/" > .npmrc npm install "@ohos/hvigor@5" "@ohos/hvigor-ohos-plugin@5" echo "HVIGOR_PATH=$PWD" >> $GITHUB_ENV - name: "Setup HAP signing config" id: signing_config env: SIGNING_MATERIAL: ${{ secrets.SERVO_OHOS_SIGNING_MATERIAL }} if: ${{ env.SIGNING_MATERIAL != '' }} # Allows the build to pass on forks. run: | cd ~ echo "${SIGNING_MATERIAL}" | base64 -d > servo-ohos-material.zip unzip servo-ohos-material.zip echo "SERVO_OHOS_SIGNING_CONFIG=${PWD}/servo-ohos-material/signing-configs.json" >> $GITHUB_ENV echo "signed=true" >> "$GITHUB_OUTPUT" - name: Build (arch ${{ matrix.target }} profile ${{ inputs.profile }}) env: OHOS_SDK_NATIVE: ${{ steps.setup_sdk.outputs.ohos_sdk_native }} OHOS_BASE_SDK_HOME: ${{ steps.setup_sdk.outputs.ohos-base-sdk-home }} run: | ./mach build --locked --target ${{ matrix.target }} --profile ${{ inputs.profile }} mv target/cargo-timings target/cargo-timings-ohos-${{ matrix.target }} - name: Archive build timing uses: actions/upload-artifact@v7 with: name: cargo-timings-ohos-${{ matrix.target }}-${{ inputs.profile }} # Using a wildcard here ensures that the archive includes the path. path: target/cargo-timings-* if-no-files-found: error - name: Upload shared library if: ${{ inputs.upload_library }} uses: actions/upload-artifact@v7 id: upload-library with: name: ${{ inputs.profile }}-library-ohos-${{ matrix.target }} path: target/${{ matrix.target }}/${{ inputs.profile }}/libservoshell.so if-no-files-found: error - name: Upload signed HAP artifact if: ${{ env.SERVO_OHOS_SIGNING_CONFIG != '' }} # Build output has different name if not signed. uses: actions/upload-artifact@v7 id: upload-hap-signed with: name: ${{ inputs.profile }}-binary-ohos-${{ matrix.target }} path: target/openharmony/${{ matrix.target }}/${{ inputs.profile }}/entry/build/default/outputs/default/servoshell-default-signed.hap if-no-files-found: error - name: Upload unsigned HAP artifact if: ${{ env.SERVO_OHOS_SIGNING_CONFIG == '' }} # Build output has different name if not signed. uses: actions/upload-artifact@v7 id: upload-hap-unsigned with: name: ${{ inputs.profile }}-binary-ohos-${{ matrix.target }} path: target/openharmony/${{ matrix.target }}/${{ inputs.profile }}/entry/build/default/outputs/default/servoshell-default-unsigned.hap if-no-files-found: error - name: Collect artifact IDs needed by the release workflow # The implicit assumption here is that `upload_library` is true and the signed hap is uploaded, # since this output will only be consumed by the release workflow. if: matrix.target == 'aarch64-unknown-linux-ohos' id: artifact_ids shell: bash run: | echo "artifact_ids=${{steps.upload-library.outputs.artifact-id}},${{steps.upload-hap-signed.outputs.artifact-id}}" >> $GITHUB_OUTPUT bencher: needs: ["build-openharmony"] strategy: matrix: target: ["aarch64-unknown-linux-ohos", "x86_64-unknown-linux-ohos"] if: ${{ inputs.bencher && inputs.profile != 'debug' && github.event_name != 'workflow_dispatch' && github.event_name != 'merge_group' }} uses: ./.github/workflows/bencher.yml with: target: ohos-${{ matrix.target }} profile: ${{ inputs.profile }} compressed-file-path: ${{ inputs.profile }}-binary-ohos-${{ matrix.target }}/servoshell-default-${{ needs.build-openharmony.outputs.signed && 'signed' || 'unsigned' }}.hap binary-path: libs/${{ matrix.target == 'aarch64-unknown-linux-ohos' && 'arm64-v8a' || matrix.target == 'x86_64-unknown-linux-ohos' && 'x86_64' }}/libservoshell.so file-size: true speedometer: false dromaeo: false secrets: inherit # Note: We could potentially also merge this build job with the above one, # if we figure out how to make hvigor build for harmonyos without the HOS commandline-tools installed. build-harmonyos-aarch64: name: HarmonyOS Build (aarch64) timeout-minutes: 60 runs-on: hos-builder if: github.repository == 'servo/servo' outputs: # We need to save the job status as an output, since our usage of `continue-on-error` # will make `needs.build-harmonyos-aarch64.result` evaluate to `success` even if the job failed. job_status: ${{ steps.result.outputs.JOB_STATUS }} steps: - uses: servo/ci-runners/actions/checkout@a05e7e830e3f4d4c71bdc5a38f003f052b72668c - name: Adding test files to directory run: cp -r support/hitrace-bencher/* support/openharmony/AppScope/resources/resfile/ - name: Build for aarch64 HarmonyOS run: | ./mach build --locked --target aarch64-unknown-linux-ohos --profile=${{ inputs.profile }} --flavor=harmonyos --no-default-features --features tracing,tracing-hitrace - uses: actions/upload-artifact@v7 with: # Upload the **unsigned** artifact - We don't have the signing materials in pull request workflows name: servoshell-hos-${{ inputs.profile }}.hap path: target/openharmony/aarch64-unknown-linux-ohos/${{ inputs.profile }}/entry/build/harmonyos/outputs/default/servoshell-default-unsigned.hap if-no-files-found: error - name: Save result as job output id: result if: always() run: echo "JOB_STATUS=${{ job.status }}" | tee $GITHUB_OUTPUT bench-harmonyos-aarch64: name: Benching HarmonyOS aarch64 timeout-minutes: 40 env: # This will ensure the scenario pyproject.toml is picked up and the correct venv used. UV_PROJECT: "etc/ci/scenario" continue-on-error: true runs-on: hos-runner needs: build-harmonyos-aarch64 outputs: job_status: ${{ steps.result.outputs.JOB_STATUS }} if: github.repository == 'servo/servo' && needs.build-harmonyos-aarch64.outputs.job_status == 'success' steps: - uses: actions/download-artifact@v8 with: # Name of the artifact to download. # If unspecified, all artifacts for the run are downloaded. name: servoshell-hos-${{ inputs.profile }}.hap - name: Test hdc device # First we ensure a device is actually connected and working. run: timeout 10 hdc wait - name: Sign the hap run: | ls -la /usr/bin/sign-hos.sh servoshell-default-unsigned.hap servoshell-hos-signed.hap - name: Install id: install_servo run: | # Uninstall first. hdc is not very reliable in terms of exiting with an error, so we uninstall first # to make sure we don't use a previous version if installation failed for some reason. hdc uninstall org.servo.servo hdc install -r servoshell-hos-signed.hap - uses: actions/checkout@v6 if: github.event_name != 'pull_request_target' with: fetch-depth: 0 - uses: actions/checkout@v6 if: github.event_name == 'pull_request_target' with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 allow-unsafe-pr-checkout: true - name: Setup Python uses: ./.github/actions/setup-python - name: Get model name id: hdc_product_name # awk is used to remove trailing spaces run: | echo "MODEL_NAME=$(hdc shell param get const.product.name | awk '{$1=$1;print}' )" >> $GITHUB_OUTPUT - name: Getting hitrace-bench version run: echo "INSTALLED_HITRACE_BENCH_VERSION=$(hitrace-bench --version | awk '{print $2}')" >> $GITHUB_ENV - name: Install hitrace-bench run: cargo install --locked hitrace-bench --version $HITRACE_BENCH_VERSION if: ${{ env.INSTALLED_HITRACE_BENCH_VERSION != env.HITRACE_BENCH_VERSION }} - uses: bencherdev/bencher@main # set options - name: Set bencher opts for PRs (label try run) if: github.event_name == 'pull_request_target' run: | echo "RUN_BENCHER_OPTIONS=--branch ${{ github.event.number }}/PR \ --start-point ${{ github.base_ref }} \ --start-point-hash ${{ github.event.pull_request.base.sha }} \ --start-point-reset \ --start-point-clone-thresholds" >> "$GITHUB_ENV" - name: Set bencher opts for main if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} run: | echo "RUN_BENCHER_OPTIONS=--branch main" >> "$GITHUB_ENV" - name: Set bencher opts for try branch if: ${{ github.event_name == 'push' && github.ref_name == 'try' }} run: | git remote add upstream https://github.com/servo/servo git fetch upstream main echo "RUN_BENCHER_OPTIONS=--branch try \ --hash $(git rev-parse HEAD~1) \ --start-point main \ --start-point-hash $(git merge-base upstream/main HEAD) \ --start-point-clone-thresholds \ --start-point-reset" >> "$GITHUB_ENV" # Up until this point everything is setup. Since we run multiple benchmarks in one job, # and they can fail independently, we perform all setup before this point. # This allows reducing the amount of `if` statements below, which allow steps to run # even if a previous step (for an unrelated benchmark) failed. # We add a dummy step here, so that we can check if we completed the setup successfully. - name: Setup complete id: setup_complete run: echo "Setup complete" - name: Get mitmproxy cache id: mitmproxy-cache uses: actions/cache@v5 with: path: /tmp/mitmproxy-dump key: ${{ env.MITMDUMP_CACHE_KEY }} - name: Generate mitmproxy dump if: steps.mitmproxy-cache.outputs.cache-hit != 'true' run: uv run etc/ci/scenario/update_mitmproxy_dump.py /tmp/mitmproxy-dump - name: Save Cache if: steps.mitmproxy-cache.outputs.cache-hit != 'true' id: cache-mitmproxy-save uses: actions/cache/save@v5 with: path: /tmp/mitmproxy-dump key: ${{ env.MITMDUMP_CACHE_KEY }} - name: "Run benchmark" id: hitrace_bench run: hitrace-bench -r support/hitrace-bencher/runs.json --bencher -p ${{ inputs.profile }} - name: Upload failure screenshots if: ${{ steps.hitrace_bench.success == 'failure' }} uses: actions/upload-artifact@v7 with: name: bencher-${{ inputs.profile }}-failure-screenshot path: "/tmp/servo.jpeg" if-no-files-found: error - name: Run speedometer id: speedometer run: uv run ./etc/ci/scenario/servo_speedometer.py ${{ inputs.profile }} timeout-minutes: 10 if: ${{ !cancelled() && steps.setup_complete.outcome == 'success' }} - name: Handle failed speedometer if: ${{ !cancelled() && steps.speedometer.outcome == 'failure' }} run: | touch speedometer.json # Create an empty file for bencher. mkdir speedometer_error_logs hdc shell snapshot_display -f /data/local/tmp/servo.jpeg hdc file recv /data/local/tmp/servo.jpeg speedometer_error_logs/servo_hos_screenshot.jpeg # Todo: Upload logs. This is currently not possible since the test-speedometer-ohos command # sets a log filter, which filters everything except JS console output. - uses: actions/upload-artifact@v7 if: ${{ !cancelled() && steps.speedometer.outcome == 'failure' }} with: name: ohos-speedometer-failure-${{ matrix.target }}-${{ inputs.profile }} path: speedometer_error_logs if-no-files-found: error - name: Combining bencher files if: ${{ !cancelled() && steps.setup_complete.outcome == 'success' }} run: jq --compact-output --slurp add speedometer.json bench.json > combined-bencher.json - name: Uploading to bencher.dev # Post to bencher if at least one of the benchmarks succeeded. if: | ${{ !cancelled() && steps.setup_complete.outcome == 'success' && (steps.hitrace_bench.outcome == 'success' || steps.speedometer.outcome == 'success') }} # Note: That e.g. `--start-point` is ignored if it is an empty string, # which should be the case on e.g. normal push workflows on main. run: | bencher run --adapter json \ --file combined-bencher.json \ --project '${{ env.BENCHER_PROJECT }}' \ --token '${{ secrets.BENCHER_API_TOKEN }}' \ --github-actions '${{ secrets.GITHUB_TOKEN }}' \ --testbed="${{steps.hdc_product_name.outputs.MODEL_NAME}}" \ $RUN_BENCHER_OPTIONS - name: Save result as job output id: result if: always() run: echo "JOB_STATUS=${{ job.status }}" | tee $GITHUB_OUTPUT scenario-test-harmonyos: name: Mossel Scenario test continue-on-error: true timeout-minutes: 20 runs-on: hos-runner if: github.repository == 'servo/servo' && needs.build-harmonyos-aarch64.outputs.job_status == 'success' needs: build-harmonyos-aarch64 outputs: job_status: ${{ steps.result.outputs.JOB_STATUS }} env: # This will ensure the scenario pyproject.toml is picked up and the correct venv used. UV_PROJECT: "etc/ci/scenario" steps: - uses: actions/download-artifact@v8 with: # Name of the artifact to download. # If unspecified, all artifacts for the run are downloaded. name: servoshell-hos-${{ inputs.profile }}.hap - name: Test hdc device # First we ensure a device is actually connected and working. run: timeout 10 hdc wait - name: Sign the hap run: | ls -la /usr/bin/sign-hos.sh servoshell-default-unsigned.hap servoshell-hos-signed.hap - name: Install id: install_hap run: | # Uninstall first. hdc is not very reliable in terms of exiting with an error, so we uninstall first # to make sure we don't use a previous version if installation failed for some reason. hdc uninstall org.servo.servo hdc install -r servoshell-hos-signed.hap - name: Checkout scenario scripts uses: actions/checkout@v6 with: sparse-checkout: | etc/ci/scenario - name: Get mitmproxy cache id: mitmproxy-cache uses: actions/cache@v5 with: path: /tmp/mitmproxy-dump key: ${{ env.MITMDUMP_CACHE_KEY }} - name: Generate mitmproxy dump if: steps.mitmproxy-cache.outputs.cache-hit != 'true' run: uv run etc/ci/scenario/update_mitmproxy_dump.py /tmp/mitmproxy-dump - name: Save Cache if: steps.mitmproxy-cache.outputs.cache-hit != 'true' id: cache-mitmproxy-save uses: actions/cache/save@v5 with: path: /tmp/mitmproxy-dump key: ${{ env.MITMDUMP_CACHE_KEY }} - name: Test loading servo.org run: uv run ./etc/ci/scenario/servo_test_open_page_servo.py - name: Test loading Mossel homepage if: ${{ steps.install_hap.outcome == 'success' && ! cancelled() }} run: uv run ./etc/ci/scenario/servo_test_open_page_base.py - name: Test Mossel Redirect if: ${{ steps.install_hap.outcome == 'success' && ! cancelled() }} run: uv run ./etc/ci/scenario/servo_test_redirection.py - name: Test Mossel Slide if: ${{ steps.install_hap.outcome == 'success' && ! cancelled() }} run: uv run ./etc/ci/scenario/servo_test_slide.py - name: Upload failure screenshots if: ${{ steps.install_hap.outcome == 'success' && failure() }} uses: actions/upload-artifact@v7 with: name: hos-${{ inputs.profile }}-scenario-failures-screenshots path: "servo_scenario_*_error.jpg" if-no-files-found: error - name: Save result as job output id: result if: always() run: echo "JOB_STATUS=${{ job.status }}" | tee $GITHUB_OUTPUT # This job is used to collect the result (success/failure) of all jobs in the workflow that use # `continue-on-error: true`. This allows us to pass throw information about failed "optional" jobs, # to the try-label parser, so it can include the information in the try-label comment. collect-job-results: name: Collect Job Results runs-on: ubuntu-latest needs: [build-harmonyos-aarch64, bench-harmonyos-aarch64, scenario-test-harmonyos] outputs: collected_job_status: ${{ steps.result.outputs.JOB_RESULTS_JSON }} steps: - name: Save result as job output id: result run: | JSON_FMT='{"build-harmonyos-aarch64":{"result":"%s"},"bench-harmonyos-aarch64":{"result":"%s"},"scenario-test-harmonyos":{"result":"%s"}}' printf "JOB_RESULTS_JSON=$JSON_FMT" \ "${{ needs.build-harmonyos-aarch64.outputs.job_status }}" \ "${{ needs.bench-harmonyos-aarch64.outputs.job_status }}" \ "${{ needs.scenario-test-harmonyos.outputs.job_status }}" \ >> $GITHUB_OUTPUT