From c2cb7450232ae90d2e545ddfa9aa1da6c9cd446c Mon Sep 17 00:00:00 2001 From: Juan Ramos Date: Fri, 18 Aug 2023 14:12:38 -0600 Subject: [PATCH] ci: Cleanup GitHub Actions CI Fixup performance issues Fixup CI warnings --- .github/workflows/{ci_build.yml => ci.yml} | 64 ++++------------------ .github/workflows/format.yml | 32 +++++++++++ CMakeUserPresets.json | 24 ++++++++ scripts/github_ci_android.py | 17 +++--- 4 files changed, 75 insertions(+), 62 deletions(-) rename .github/workflows/{ci_build.yml => ci.yml} (60%) create mode 100644 .github/workflows/format.yml create mode 100644 CMakeUserPresets.json diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci.yml similarity index 60% rename from .github/workflows/ci_build.yml rename to .github/workflows/ci.yml index e166c29a74..7b1c4795e5 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ -#!/usr/bin/env python3 -# Copyright (c) 2021 Valve Corporation -# Copyright (c) 2021 LunarG, Inc. - +# Copyright (c) 2023 Valve Corporation +# Copyright (c) 2023 LunarG, Inc. +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -13,11 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Author: Mark Lobodzinski -# Author: Tony Barbour -name: CI Build +name: ci on: push: @@ -26,27 +22,6 @@ on: - main jobs: - code-format: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} - strategy: - fail-fast: false - matrix: - config: - - { - name: "Source Code Format Testing", - os: ubuntu-latest, - cc: "gcc", cxx: "g++" - } - steps: - - name: Install Qt - uses: jurplel/install-qt-action@v3 - - name: Clone repository - uses: actions/checkout@v1 - - name: Execute Source Code Format Checking Script - run: | - scripts/check_code_format.sh --target-refspec=origin/${{ github.base_ref }} - linux: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} @@ -72,7 +47,7 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v3 - name: Clone repository - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Install build dependencies run: | sudo apt-get -qq update @@ -95,34 +70,19 @@ jobs: steps: - name: Install Qt uses: jurplel/install-qt-action@v3 - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: '3.7' - name: Build and Test VulkanTools run: python3 scripts/github_ci_win.py --config ${{ matrix.config }} --arch ${{ matrix.arch }} android: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} + runs-on: ubuntu-22.04 strategy: - fail-fast: false matrix: - config: - - { - name: "Android armeabi-v8a", - os: ubuntu-latest, - abi: arm64-v8a, - ndk: r21d, - } - - { - name: "Android armeabi-v7a", - os: ubuntu-latest, - abi: armeabi-v7a, - ndk: r21d, - } + abi: [ arm64-v8a , armeabi-v7a ] steps: - - name: Clone repository - uses: actions/checkout@v1 - - name: Build VulkanTools - run: python3 scripts/github_ci_android.py --abi ${{ matrix.config.abi }} + - uses: actions/checkout@v3 + - name: ndk-build + run: python scripts/github_ci_android.py --abi ${{ matrix.abi }} diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000000..ce83152d37 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,32 @@ +# Copyright (c) 2023 Valve Corporation +# Copyright (c) 2023 LunarG, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: format + +on: + push: + pull_request: + branches: + - main + +jobs: + code-format: + name: Source Code Format Testing + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Execute Source Code Format Checking Script + run: | + scripts/check_code_format.sh --target-refspec=origin/${{ github.base_ref }} diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json new file mode 100644 index 0000000000..0fd1ce54ba --- /dev/null +++ b/CMakeUserPresets.json @@ -0,0 +1,24 @@ +{ + "version": 3, + "cmakeMinimumRequired": { + "major": 3, + "minor": 26, + "patch": 0 + }, + "configurePresets": [ + { + "name": "android", + "displayName": "Generic Developer Preset (Android)", + "description": "Sets common developer flags", + "binaryDir": "${sourceDir}/build/android/", + "toolchainFile": "~/Android/Sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake", + "cacheVariables": { + "ANDROID_PLATFORM": "26", + "CMAKE_ANDROID_ARCH_ABI": "arm64-v8a", + "CMAKE_ANDROID_STL_TYPE": "c++_static", + "ANDROID_USE_LEGACY_TOOLCHAIN_FILE": "OFF", + "BUILD_TESTS": "ON" + } + } + ] +} \ No newline at end of file diff --git a/scripts/github_ci_android.py b/scripts/github_ci_android.py index b594122f19..5127af4cb4 100644 --- a/scripts/github_ci_android.py +++ b/scripts/github_ci_android.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2021Valve Corporation -# Copyright (c) 2021 LunarG, Inc. +# Copyright (c) 2021-2023 Valve Corporation +# Copyright (c) 2021-2023 LunarG, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,15 +49,12 @@ def RunShellCmd(command, start_dir = PROJECT_ROOT): # # Fetch Android components, build Android VVL def BuildAndroid(target_abi): - print("Fetching NDK\n") - wget_cmd = 'wget http://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip' - RunShellCmd(wget_cmd) + # GitHub actions already comes with NDK pre-installed. We should avoid downloading unless we have to. + # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#environment-variables-2 + if "ANDROID_NDK_HOME" not in os.environ: + print('ANDROID_NDK_HOME not defined!') + sys.exit(1) - print("Extracting NDK components\n") - unzip_cmd = 'unzip -u -q android-ndk-r21d-linux-x86_64.zip' - RunShellCmd(unzip_cmd) - # Add NDK to path - os.environ['ANDROID_NDK_HOME'] = repo_relative('android-ndk-r21d') os.environ['PATH'] = os.environ.get('ANDROID_NDK_HOME') + os.pathsep + os.environ.get('PATH') print("Preparing Android Dependencies\n")