Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test tests #637

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 97 additions & 34 deletions .github/actions/on_device_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@ description: Runs on-device tests.
runs:
using: "composite"
steps:
- name: Install requirements
- name: Install Requirements
run: |
pip3 install grpcio==1.38.0 grpcio-tools==1.38.0
shell: bash
- name: Generate gRPC files
run: |
python -m grpc_tools.protoc -Itools/ --python_out=tools/ --grpc_python_out=tools/ tools/on_device_tests_gateway.proto
shell: bash
- name: Set up Cloud SDK
- name: Set Up Cloud SDK
uses: isarkis/setup-gcloud@40dce7857b354839efac498d3632050f568090b6 # v1.1.1
- name: Set env vars
env:
WORKFLOW: ${{ github.workflow }}
run: |
echo "PROJECT_NAME=$(gcloud config get-value project)" >> $GITHUB_ENV
echo "GITHUB_RUN_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
echo "WORKFLOW=${WORKFLOW}" >> $GITHUB_ENV

# Boot loader env
if [ "${COBALT_EVERGREEN_LOADER}" != "null" ]; then
Expand All @@ -43,8 +39,10 @@ runs:
echo "USE_SHARDING=1" >> $GITHUB_ENV
fi
shell: bash
- name: run ${{ env.SHARD_NAME }} tests on ${{ matrix.platform }} platform
- name: Run ${{ env.SHARD_NAME }} Tests on ${{ matrix.platform }} Platform
env:
GCS_PATH: gs://${{ env.PROJECT_NAME }}-test-artifacts/${{ github.workflow }}/${{ env.GITHUB_RUN_NUMBER }}/${{ matrix.platform }}_${{ matrix.config }}
GCS_RESULTS_PATH: gs://cobalt-unittest-storage/results
GITHUB_SHA: ${{ github.sha }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
Expand All @@ -58,34 +56,99 @@ runs:
GITHUB_COMMIT_AUTHOR_USERNAME: ${{ github.event.commits[0].author.username }}
GITHUB_COMMIT_AUTHOR_EMAIL: ${{ github.event.commits[0].author.email }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GITHUB_WORKFLOW: ${{ github.workflow }}
run: |
set -uxe
python3 -u tools/on_device_tests_gateway_client.py \
--token ${GITHUB_TOKEN} \
--change_id ${GITHUB_PR_NUMBER:-postsubmit} \
trigger \
--test_type ${{ env.TEST_TYPE }} \
--platform ${{ matrix.target_platform }} \
--config ${{ matrix.config }} \
--tag cobalt_github_${GITHUB_EVENT_NAME} \
--builder_name github_${{ matrix.platform }}_tests \
--build_number ${GITHUB_RUN_NUMBER} \
--builder_url ${GITHUB_RUN_URL} \
${LOADER_PLATFORM:+"--loader_config" "$LOADER_CONFIG"} \
${LOADER_PLATFORM:+"--loader_platform" "$LOADER_PLATFORM"} \
${DIMENSION:+"--dimension" "$DIMENSION"} \
${USE_SHARDING:+"--unittest_shard_index" "${{ matrix.shard }}"} \
${ON_DEVICE_TEST_ATTEMPTS:+"--test_attempts" "$ON_DEVICE_TEST_ATTEMPTS"} \
--archive_path gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{ matrix.platform }}_${{ matrix.config }}/artifacts.tar \
--label github \
--label ${GITHUB_EVENT_NAME} \
--label ${WORKFLOW} \
--label actor-${GITHUB_ACTOR} \
--label actor_id-${GITHUB_ACTOR_ID} \
--label triggering_actor-${GITHUB_TRIGGERING_ACTOR} \
--label sha-${GITHUB_SHA} \
--label repository-${GITHUB_REPO} \
--label author-${GITHUB_PR_HEAD_USER_LOGIN:-$GITHUB_COMMIT_AUTHOR_USERNAME} \
--label author_id-${GITHUB_PR_HEAD_USER_ID:-$GITHUB_COMMIT_AUTHOR_EMAIL}
# python3 -u tools/on_device_tests_gateway_client.py \
# --token ${GITHUB_TOKEN} \
# --change_id ${GITHUB_PR_NUMBER:-postsubmit} \
# trigger \
# --test_type ${{ env.TEST_TYPE }} \
# --platform ${{ matrix.target_platform }} \
# --config ${{ matrix.config }} \
# --tag cobalt_github_${GITHUB_EVENT_NAME} \
# --builder_name github_${{ matrix.platform }}_tests \
# --build_number ${GITHUB_RUN_NUMBER} \
# --builder_url ${GITHUB_RUN_URL} \
# ${LOADER_PLATFORM:+"--loader_config" "$LOADER_CONFIG"} \
# ${LOADER_PLATFORM:+"--loader_platform" "$LOADER_PLATFORM"} \
# ${DIMENSION:+"--dimension" "$DIMENSION"} \
# ${USE_SHARDING:+"--unittest_shard_index" "${{ matrix.shard }}"} \
# ${ON_DEVICE_TEST_ATTEMPTS:+"--test_attempts" "$ON_DEVICE_TEST_ATTEMPTS"} \
# --archive_path "${GCS_PATH}/artifacts.tar" \
# --gcs_result_path "${GCS_RESULTS_PATH}/${GITHUB_RUN_ID}/" \
# --label github \
# --label ${GITHUB_EVENT_NAME} \
# --label ${GITHUB_WORKFLOW} \
# --label actor-${GITHUB_ACTOR} \
# --label actor_id-${GITHUB_ACTOR_ID} \
# --label triggering_actor-${GITHUB_TRIGGERING_ACTOR} \
# --label sha-${GITHUB_SHA} \
# --label repository-${GITHUB_REPO} \
# --label author-${GITHUB_PR_HEAD_USER_LOGIN:-$GITHUB_COMMIT_AUTHOR_USERNAME} \
# --label author_id-${GITHUB_PR_HEAD_USER_ID:-$GITHUB_COMMIT_AUTHOR_EMAIL}

echo "hej"
shell: bash
- name: Download ${{ matrix.platform }} Test Results
if: env.TEST_TYPE == 'unit_test'
env:
COBALT_XMLS_FILENAME: cobalt_xmls.zip
RESULTS_PATH: results
run: |
set -eux
mkdir ${RESULTS_PATH}
# gsutil -d cp -r "${GCS_PATH}/results/${GITHUB_RUN_ID}" ${RESULTS_PATH}
gsutil -d cp -r gs://cobalt-unittest-storage/results_tmp/123123123 ${RESULTS_PATH}
mkdir -p ${UNIT_TEST_RESULTS}
unzip ${RESULTS_PATH}/${COBALT_XMLS_FILENAME} -d ${UNIT_TEST_RESULTS}/
shell: bash
- name: Device logs
env:
RESULTS_PATH: results
ERROR_LOG_FILE: webDriverTestLog.ERROR
run: |
set -eux
cat ${RESULTS_PATH}/${ERROR_LOG_FILE}
shell: bash
- name: Archive Unit Test Logs
uses: actions/upload-artifact@v3
if: env.TEST_TYPE == 'unit_test'
with:
name: ${{ matrix.platform }}_${{ matrix.shard }} logs
path: |
${RESULTS_PATH}/
!${RESULTS_PATH}/*.zip
- name: Get Datadog CLI
shell: bash
env:
DD_VERSION: 'v2.18.0'
DD_SHA256SUM: 'adbe9b3a41faaf0b1d9702ba256cf8fa9e474c0cc8216f25e5b489c53d6f0a70 datadog-ci'
run: |
set -e
download_url="https://github.com/DataDog/datadog-ci/releases/download/${DD_VERSION}/datadog-ci_linux-x64"
curl -L --fail $download_url --output datadog-ci
echo ${DD_SHA256SUM} | sha256sum --check
chmod +x datadog-ci
- name: Upload to Datadog
shell: bash
env:
DATADOG_API_KEY: ${{ secrets.DD_API_KEY }}
DATADOG_SITE: us5.datadoghq.com
# DD_ENV: ci
# DD_SERVICE: ${{ github.event.repository.name }}
# # Need to populate git info via env vars as we don't have the repo to look at.
# DD_GIT_REPOSITORY_URL: ${{ github.event.repository.git_url }}
# DD_GIT_COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
# DD_GIT_BRANCH: ${{ github.event.workflow_run.head_branch }}
# DD_GIT_COMMIT_MESSAGE: ${{ github.event.workflow_run.head_commit.message }}
# DD_GIT_COMMIT_AUTHOR_NAME: ${{ github.event.workflow_run.head_commit.author.name }}
# DD_GIT_COMMIT_AUTHOR_EMAIL: ${{ github.event.workflow_run.head_commit.author.email }}
# DD_GIT_COMMIT_AUTHOR_DATE: ${{ github.event.workflow_run.head_commit.timestamp }}
# DD_GIT_COMMIT_COMMITTER_NAME: ${{ github.event.workflow_run.head_commit.committer.name }}
# DD_GIT_COMMIT_COMMITTER_EMAIL: ${{ github.event.workflow_run.head_commit.committer.email }}
# DD_GIT_COMMIT_COMMITTER_DATE: ${{ github.event.workflow_run.head_commit.timestamp }}
run: |
./datadog-ci junit upload unit-test-results/*.xml
5 changes: 4 additions & 1 deletion .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: android
on:
release:
types: [prereleased, released, published]
pull_request:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
branches:
- main
Expand Down Expand Up @@ -33,6 +33,7 @@ jobs:
platform: android-arm64
nightly: ${{ github.event.inputs.nightly }}
keep_artifacts: cobalt.apk
secrets: inherit
android-x86:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -42,6 +43,7 @@ jobs:
platform: android-x86
nightly: ${{ github.event.inputs.nightly }}
keep_artifacts: cobalt.apk
secrets: inherit
android-arm:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -51,6 +53,7 @@ jobs:
platform: android-arm
nightly: ${{ github.event.inputs.nightly }}
keep_artifacts: cobalt.apk
secrets: inherit

upload-release-artifacts:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/evergreen.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: evergreen

on:
pull_request:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
branches:
- main
Expand Down Expand Up @@ -31,6 +31,7 @@ jobs:
platform: evergreen-x64
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
secrets: inherit
evergreen-arm-hardfp:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -40,6 +41,7 @@ jobs:
platform: evergreen-arm-hardfp
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
secrets: inherit
evergreen-arm-softfp:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -49,6 +51,7 @@ jobs:
platform: evergreen-arm-softfp
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
secrets: inherit
evergreen-arm64:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -58,3 +61,4 @@ jobs:
platform: evergreen-arm64
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
secrets: inherit
6 changes: 5 additions & 1 deletion .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: linux

on:
pull_request:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
branches:
- main
Expand Down Expand Up @@ -30,6 +30,7 @@ jobs:
with:
platform: linux
nightly: ${{ github.event.inputs.nightly }}
secrets: inherit
linux-clang-3-9:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -39,6 +40,7 @@ jobs:
platform: linux-clang-3-9
nightly: ${{ github.event.inputs.nightly }}
modular: true
secrets: inherit
linux-gcc-6-3:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -48,6 +50,7 @@ jobs:
platform: linux-gcc-6-3
nightly: ${{ github.event.inputs.nightly }}
modular: true
secrets: inherit
# TODO(b/285632780): Enable blackbox tests for modular linux workflows.
linux-modular:
uses: ./.github/workflows/main.yaml
Expand All @@ -58,3 +61,4 @@ jobs:
platform: linux-modular
nightly: ${{ github.event.inputs.nightly }}
modular: true
secrets: inherit
76 changes: 1 addition & 75 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -243,88 +243,14 @@ jobs:
# Use fetch depth of 0 to get full history for a valid build id.
fetch-depth: 0
persist-credentials: false
- name: Cache Gradle
uses: actions/cache@v3
if: startsWith( matrix.target_platform , 'android')
with:
key: gradle-cache-${{ hashFiles('starboard/android/apk/**/*gradle*') }}
path: |
/root/.gradle/caches
/root/.gradle/wrapper
- name: GN
uses: ./.github/actions/gn
- name: Build Cobalt
uses: ./.github/actions/build
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
if: inputs.keep_artifacts
with:
name: ${{ matrix.platform }}-${{ matrix.config }}
path: out/${{ matrix.platform }}_${{ matrix.config }}/${{ inputs.keep_artifacts }}
retention-days: 7
compression-level: 0 # We expect kept artifacts to be already compressed
if-no-files-found: error
- name: Run API Leak Detector
uses: ./.github/actions/api_leak_detector
if: inputs.run_api_leak_detector
with:
relative_manifest_path: ${{ inputs.leak_manifest_filename }}
- name: Upload On Host Test Artifacts
if: ${{ matrix.config == 'devel' && needs.initialize.outputs.on_host_test == 'true' }}
uses: ./.github/actions/upload_test_artifacts
with:
type: onhost
os: linux
# For some reason passing needs.initialize.outputs.evergreen_loader as parameter to build
# action didn't work, so instead we set an env var.
- name: Set Evergreen loader config
if: ${{ needs.initialize.outputs.evergreen_loader != 'null' }}
shell: bash
run: |
set -u
COBALT_EVERGREEN_LOADER="${{needs.initialize.outputs.evergreen_loader}}"
echo "COBALT_EVERGREEN_LOADER=${COBALT_EVERGREEN_LOADER}" >> $GITHUB_ENV
# Build Evergreen loader for on-host tests if necessary.
- name: Evergreen loader GN
if: ${{ needs.initialize.outputs.evergreen_loader != 'null' && ( matrix.config == 'devel' || matrix.config == 'qa' ) }}
uses: ./.github/actions/gn
- name: Build Evergreen loader
if: ${{ needs.initialize.outputs.evergreen_loader != 'null' && ( matrix.config == 'devel' || matrix.config == 'qa' ) }}
uses: ./.github/actions/build
- name: Upload Nightly Artifacts
if: ${{ ( inputs.nightly == 'true' || github.event_name == 'schedule' ) && matrix.config != 'debug' }}
uses: ./.github/actions/upload_nightly_artifacts
- name: Upload Evergreen loader On Host Test Artifacts
if: ${{ needs.initialize.outputs.evergreen_loader != 'null' && matrix.config == 'devel' && needs.initialize.outputs.on_host_test == 'true'}}
uses: ./.github/actions/upload_test_artifacts
with:
type: onhost
os: linux
- name: Upload On Device Test Artifacts
if: |
matrix.config == 'devel' &&
fromJSON(needs.initialize.outputs.on_device_test).enabled == true &&
(
github.event_name != 'pull_request' ||
contains(github.event.pull_request.labels.*.name, 'on_device')
)
uses: ./.github/actions/upload_test_artifacts
with:
type: ondevice
os: linux

# Runs on-device integration and unit tests.
on-device-test:
needs: [initialize, build]
# Run ODT when on_device label is applied on PR.
# Also, run ODT on push and schedule if not explicitly disabled via repo vars.
if: |
fromJSON(needs.initialize.outputs.on_device_test).enabled == true && ((
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'on_device') ) || ((
inputs.nightly == 'true' || github.event_name == 'schedule') &&
vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
( github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False' ) )
fromJSON(needs.initialize.outputs.on_device_test).enabled == true
runs-on: [self-hosted, odt-runner]
name: ${{ matrix.name }}_on_device_${{ matrix.shard }}
permissions: {}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/raspi-2.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: raspi-2

on:
pull_request:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
branches:
- main
Expand Down Expand Up @@ -30,6 +30,7 @@ jobs:
with:
platform: raspi-2
nightly: ${{ github.event.inputs.nightly }}
secrets: inherit
raspi-2-skia:
uses: ./.github/workflows/main.yaml
permissions:
Expand All @@ -38,3 +39,4 @@ jobs:
with:
platform: raspi-2-skia
nightly: ${{ github.event.inputs.nightly }}
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/stub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ jobs:
platform: stub
nightly: ${{ github.event.inputs.nightly }}
leak_manifest_filename: "gn_built_docker_debian11_manifest"
secrets: inherit
Loading
Loading