From 47eb7acb44389d978992d38a76e7ecc31661a89a Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 7 Jan 2024 16:41:28 -0800 Subject: [PATCH] Only trigger CI workflows for code or CI changes This makes it so that the main CI workflow will only trigger if a change is made to a code file in desktop_version/ (as the CI is only for desktop_version/), or if the CI file itself is changed. The CI workflow for Android will only trigger if Android-specific code _could have_ changed. This includes all code that is definitely Android-specific (e.g. Java files), but also C/C++ files that have __ANDROID__ ifdefs. Unfortunately, it's not possible to reuse the same list of paths across two different event trigger types[1]. So we have to copy-paste here. [1]: https://github.com/orgs/community/discussions/37645 --- .github/workflows/android.yml | 42 +++++++++++++++++++++++++++++++++-- .github/workflows/ci.yml | 19 ++++++++++++++-- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 57f56504..37e9a960 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,7 +1,45 @@ name: CI (Android) -# Trigger this workflow on push or pull request -on: [push, pull_request] +# Only trigger workflow when Android-specific code could have changed. +# This includes C/C++ files that have __ANDROID__ ifdefs. +# If adding new ifdefs, make sure to update these lists. +on: + push: + paths: + - "desktop_version/CMakeLists.txt" + - "desktop_version/src/ButtonGlyphs.cpp" + - "desktop_version/src/FileSystemUtils.cpp" + - "desktop_version/src/Screen.cpp" + - "desktop_version/src/Vlogging.c" + - "desktop_version/VVVVVV-android/gradlew" + - "desktop_version/VVVVVV-android/gradlew.bat" + - "desktop_version/VVVVVV-android/**/CMakeLists.txt" + - "desktop_version/VVVVVV-android/**.java" + - "desktop_version/VVVVVV-android/**.xml" + - "desktop_version/VVVVVV-android/**.pro" + - "desktop_version/VVVVVV-android/**.mk" + - "desktop_version/VVVVVV-android/**.gradle" + - "desktop_version/VVVVVV-android/**.jar" + - "desktop_version/VVVVVV-android/**.properties" + - ".github/workflows/android.yml" + pull_request: + paths: + - "desktop_version/CMakeLists.txt" + - "desktop_version/src/ButtonGlyphs.cpp" + - "desktop_version/src/FileSystemUtils.cpp" + - "desktop_version/src/Screen.cpp" + - "desktop_version/src/Vlogging.c" + - "desktop_version/VVVVVV-android/gradlew" + - "desktop_version/VVVVVV-android/gradlew.bat" + - "desktop_version/VVVVVV-android/**/CMakeLists.txt" + - "desktop_version/VVVVVV-android/**.java" + - "desktop_version/VVVVVV-android/**.xml" + - "desktop_version/VVVVVV-android/**.pro" + - "desktop_version/VVVVVV-android/**.mk" + - "desktop_version/VVVVVV-android/**.gradle" + - "desktop_version/VVVVVV-android/**.jar" + - "desktop_version/VVVVVV-android/**.properties" + - ".github/workflows/android.yml" env: SRC_DIR_PATH: VVVVVV/desktop_version/VVVVVV-android diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fab1e883..ab95e387 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,22 @@ name: CI -# Trigger this workflow on push or pull request -on: [push, pull_request] +# Only trigger workflow when code changes, or this file is changed. +# Android has a different workflow and different rules. +on: + push: + paths: + - "desktop_version/CMakeLists.txt" + - "desktop_version/src/**.cpp" + - "desktop_version/src/**.c" + - "desktop_version/src/**.h" + - ".github/workflows/ci.yml" + pull_request: + paths: + - "desktop_version/CMakeLists.txt" + - "desktop_version/src/**.cpp" + - "desktop_version/src/**.c" + - "desktop_version/src/**.h" + - ".github/workflows/ci.yml" env: SRC_DIR_PATH: desktop_version