|
| 1 | +name: Perfetto CI |
| 2 | +on: |
| 3 | + # 1. continuous |
| 4 | + schedule: |
| 5 | + # Run every 6 hours |
| 6 | + - cron: "0 */6 * * *" |
| 7 | + |
| 8 | + # 2. postsubmit |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + - test |
| 13 | + |
| 14 | + # 3. presubmits |
| 15 | + pull_request: |
| 16 | + types: [opened, synchronize] |
| 17 | + branches: |
| 18 | + - main |
| 19 | + - test |
| 20 | + |
| 21 | + |
| 22 | +jobs: |
| 23 | + test: |
| 24 | + runs-on: self-hosted |
| 25 | + timeout-minutes: 45 |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + config: |
| 29 | + # - name: linux-clang-x86_64-debug |
| 30 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=true is_hermetic_clang=false non_hermetic_clang_stdlib="libc++" enable_perfetto_merged_protos_check=true' |
| 31 | + # PERFETTO_TEST_SCRIPT: 'test/ci/linux_tests.sh' |
| 32 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '' |
| 33 | + # - name: linux-clang-x86_64-tsan |
| 34 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=false is_tsan=true' |
| 35 | + # PERFETTO_TEST_SCRIPT: 'test/ci/linux_tests.sh' |
| 36 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '' |
| 37 | + # - name: linux-clang-x86_64-msan |
| 38 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=false is_msan=true' |
| 39 | + # PERFETTO_TEST_SCRIPT: 'test/ci/linux_tests.sh' |
| 40 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '' |
| 41 | + # - name: linux-clang-x86_64-asan_lsan |
| 42 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=false is_asan=true is_lsan=true' |
| 43 | + # PERFETTO_TEST_SCRIPT: 'test/ci/linux_tests.sh' |
| 44 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '' |
| 45 | + # - name: linux-clang-x86-release |
| 46 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=false target_cpu="x86"' |
| 47 | + # PERFETTO_TEST_SCRIPT: 'test/ci/linux_tests.sh' |
| 48 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '' |
| 49 | + # - name: linux-gcc8-x86_64-release |
| 50 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=false is_clang=false enable_perfetto_grpc=true cc="gcc-8" cxx="g++-8"' |
| 51 | + # PERFETTO_TEST_SCRIPT: 'test/ci/linux_tests.sh' |
| 52 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '--grpc' |
| 53 | + # - name: android-clang-arm-release |
| 54 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=false target_os="android" target_cpu="arm"' |
| 55 | + # PERFETTO_TEST_SCRIPT: 'test/ci/android_tests.sh' |
| 56 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '--android' |
| 57 | + # - name: linux-clang-x86_64-libfuzzer |
| 58 | + # PERFETTO_TEST_GN_ARGS: 'is_debug=false is_fuzzer=true is_asan=true' |
| 59 | + # PERFETTO_TEST_SCRIPT: 'test/ci/fuzzer_tests.sh' |
| 60 | + # PERFETTO_INSTALL_BUILD_DEPS_ARGS: '' |
| 61 | + - name: linux-clang-x86_64-bazel |
| 62 | + PERFETTO_TEST_GN_ARGS: '' |
| 63 | + PERFETTO_TEST_SCRIPT: 'test/ci/bazel_tests.sh' |
| 64 | + PERFETTO_INSTALL_BUILD_DEPS_ARGS: '--bazel' |
| 65 | + - name: ui-clang-x86_64-release |
| 66 | + PERFETTO_TEST_GN_ARGS: 'is_debug=false' |
| 67 | + PERFETTO_TEST_SCRIPT: 'test/ci/ui_tests.sh' |
| 68 | + PERFETTO_INSTALL_BUILD_DEPS_ARGS: '--ui' |
| 69 | + |
| 70 | + env: |
| 71 | + # /tmp/cache contains {ccache, bazelcache} and generally any other cache |
| 72 | + # that should be persisted across jobs, but only updated from the main |
| 73 | + # branch. This is populated by the "actions/cache/restore" step below. |
| 74 | + # TODO here check this between docker and this. DNS |
| 75 | + PERFETTO_CACHE_DIR: /tmp/cache |
| 76 | + PERFETTO_TEST_GN_ARGS: ${{ matrix.config.PERFETTO_TEST_GN_ARGS }} |
| 77 | + PERFETTO_TEST_SCRIPT: ${{ matrix.config.PERFETTO_TEST_SCRIPT }} |
| 78 | + PERFETTO_INSTALL_BUILD_DEPS_ARGS: ${{ matrix.config.PERFETTO_INSTALL_BUILD_DEPS_ARGS }} |
| 79 | + PERFETTO_TEST_JOB: gh-${{ github.run_id }}-${{ matrix.config.name }} |
| 80 | + PERFETTO_TEST_NINJA_ARGS: # Deliberately empty, set in some other env |
| 81 | + steps: |
| 82 | + - name: Set up artifacts |
| 83 | + run: | |
| 84 | + mkdir -p ${{ env.PERFETTO_CACHE_DIR }} |
| 85 | + PERFETTO_ARTIFACTS_DIR=/tmp/artifacts/$PERFETTO_TEST_JOB |
| 86 | + echo "PERFETTO_ARTIFACTS_DIR=$PERFETTO_ARTIFACTS_DIR" >> $GITHUB_ENV |
| 87 | + mkdir -p $PERFETTO_ARTIFACTS_DIR |
| 88 | +
|
| 89 | + # Check out code. |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + with: |
| 92 | + fetch-depth: 2 |
| 93 | + |
| 94 | + - name: Set up cache |
| 95 | + # By default ccache uses the mtime of the compiler. This doesn't work |
| 96 | + # because our compilers are hermetic and their mtime is the time when we |
| 97 | + # run install-build-deps. Given that the toolchain is rolled via |
| 98 | + # install-build-deps we use that file as an identity function for the |
| 99 | + # compiler check. |
| 100 | + run: | |
| 101 | + CCACHE_DIR=${{ env.PERFETTO_CACHE_DIR }}/ccache |
| 102 | + mkdir -p $CCACHE_DIR |
| 103 | + DEPS_SHA=$(shasum "tools/install-build-deps" | awk '{print $1}') |
| 104 | + echo "DEPS_SHA=$DEPS_SHA" >> $GITHUB_ENV |
| 105 | + echo "CCACHE_COMPILERCHECK=string:$DEPS_SHA" >> $GITHUB_ENV |
| 106 | + echo "CCACHE_BASEDIR=${{ github.workspace }}" >> $GITHUB_ENV |
| 107 | + echo "CCACHE_DIR=$CCACHE_DIR" >> $GITHUB_ENV |
| 108 | + echo "CCACHE_MAXSIZE=8G" >> $GITHUB_ENV |
| 109 | + echo "CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime" >> $GITHUB_ENV |
| 110 | + echo "CCACHE_NOCOMPRESS=1" >> $GITHUB_ENV |
| 111 | + echo "CCACHE_COMPILERCHECK=string:$(shasum tools/install-build-deps)" >> $GITHUB_ENV |
| 112 | + echo "CCACHE_UMASK=000" >> $GITHUB_ENV |
| 113 | + echo "CCACHE_DEPEND=1" >> $GITHUB_ENV |
| 114 | +
|
| 115 | + # TODO remove this |
| 116 | + - name: Print env vars |
| 117 | + run: env; |
| 118 | + |
| 119 | + - name: Restore cache and buildtools from GitHub cache |
| 120 | + uses: actions/cache/restore@v4 |
| 121 | + with: |
| 122 | + path: | |
| 123 | + ${{ env.PERFETTO_CACHE_DIR }} |
| 124 | + buildtools |
| 125 | + key: cache-${{ matrix.config.name }}-${{ env.DEPS_SHA }} |
| 126 | + |
| 127 | + - name: ls cache |
| 128 | + run: ls -laR ${{ env.PERFETTO_CACHE_DIR }} |
| 129 | + |
| 130 | + - name: Build and test |
| 131 | + run: ${{ env.PERFETTO_TEST_SCRIPT }} |
| 132 | + shell: bash |
| 133 | + |
| 134 | + - name: ccache stats |
| 135 | + run: ccache --show-stats |
| 136 | + |
| 137 | + - name: Upload artifacts to GCS |
| 138 | + if: ${{ always() }} |
| 139 | + run: /opt/ci/artifacts_uploader --rm ${{ env.PERFETTO_ARTIFACTS_DIR }} |
| 140 | + |
| 141 | + - name: Update cache (if on main) |
| 142 | + if: github.ref == 'refs/heads/main' |
| 143 | + uses: actions/cache/save@v4 |
| 144 | + with: |
| 145 | + path: | |
| 146 | + ${{ env.PERFETTO_CACHE_DIR }} |
| 147 | + buildtools |
| 148 | + key: cache-${{ matrix.config.name }}-${{ env.DEPS_SHA }} |
0 commit comments