Skip to content

Commit

Permalink
Only trigger CI workflows for code or CI changes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
InfoTeddy committed Jan 8, 2024
1 parent 5f7cb46 commit 47eb7ac
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 4 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 47eb7ac

Please sign in to comment.