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

ci: Run CI workflows when their configuration file is changed #9945

Merged
merged 12 commits into from
Mar 26, 2024
11 changes: 9 additions & 2 deletions .github/path-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,12 @@ copyright:
changelog:
- changelog

parse_script:
- utils/test_parse.ps1
ci_config:
- '.github/workflows/ci.yml'
- '.github/path-filters.yml'
- '.github/compute-changes.yml'
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved

projects_check_config:
- '.github/workflows/projects_check.yml'
- '.github/path-filters.yml'
- '.github/compute-changes.yml'
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
build_ubuntu:
name: Ubuntu
needs: changed
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.cmake_files == 'true' }}
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
runs-on: ubuntu-${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
build_windows:
name: Windows
needs: changed
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' }}
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
runs-on: windows-2022
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
build_windows_clang:
name: Windows Clang
needs: changed
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' }}
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
runs-on: windows-2022
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -141,7 +141,7 @@ jobs:
build_macos:
name: MacOS
needs: changed
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' }}
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
runs-on: macos-12
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
test-parse:
needs: [changed, build_windows]
name: Data Files
if: ${{ (needs.changed.outputs.game_code == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.data == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.parse_script == 'true') && always() }}
if: ${{ (needs.changed.outputs.game_code == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.data == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.ci_config == 'true') && always() }}
runs-on: windows-2022
env:
CONTINUOUS: EndlessSky-win64-continuous.zip
Expand All @@ -180,22 +180,22 @@ jobs:
show-progress: false
# If no code changes occurred then we can download the latest continuous.
- name: Download latest continuous
if: ${{ needs.changed.outputs.game_code != 'true' && needs.changed.outputs.cmake_files != 'true' }}
if: ${{ needs.changed.outputs.game_code != 'true' && needs.changed.outputs.cmake_files != 'true' && needs.changed.outputs.ci_config != 'true' }}
run: gh release download -R ${{ github.repository }} continuous -p ${{ env.CONTINUOUS }}
- name: Extract and prepare continuous
if: ${{ needs.changed.outputs.game_code != 'true' && needs.changed.outputs.cmake_files != 'true' }}
if: ${{ needs.changed.outputs.game_code != 'true' && needs.changed.outputs.cmake_files != 'true' && needs.changed.outputs.ci_config != 'true' }}
run: |
Expand-Archive ${{ env.CONTINUOUS }} -DestinationPath continuous -Force
COPY '.\continuous\Endless Sky.exe' .
COPY '.\continuous\*.dll' .
# Otherwise download the binary from CI.
- name: Download game binary from CI
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.cmake_files == 'true' }}
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
uses: actions/download-artifact@v4
with:
name: binary-windows
- name: Download DLLs from CI
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.cmake_files == 'true' }}
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.ci_config == 'true' }}
uses: actions/download-artifact@v4
with:
name: windows-dlls
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/compute-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ on:
value: ${{ jobs.changed.outputs.copyright }}
changelog:
value: ${{ jobs.changed.outputs.changelog }}
parse_script:
value: ${{ jobs.changed.outputs.parse_script }}
content_style_script:
value: ${{ jobs.changed.outputs.content_style_script }}
ci_config:
value: ${{ jobs.changed.outputs.ci_config }}
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
projects_check_config:
value: ${{ jobs.changed.outputs.projects_check_config }}

jobs:
changed:
Expand All @@ -45,8 +47,9 @@ jobs:
cmake_files: ${{ steps.filter.outputs.cmake_files }}
copyright: ${{ steps.filter.outputs.copyright }}
changelog: ${{ steps.filter.outputs.changelog }}
parse_script: ${{ steps.filter.outputs.parse_script }}
content_style_script: ${{ steps.filter.outputs.content_style_script }}
ci_config: ${{ steps.filter.outputs.ci_config }}
projects_check_config: ${{ steps.filter.outputs.projects_check_config }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/projects_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
check_cmake:
name: CMake
needs: changed
if: ${{ needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.integration_tests == 'true' }}
if: ${{ needs.changed.outputs.cmake_files == 'true' || needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.projects_check_config }}
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -33,7 +33,7 @@ jobs:
validate_copyright:
name: Copyright
needs: changed
if: ${{ needs.changed.outputs.copyright == 'true' }}
if: ${{ needs.changed.outputs.copyright == 'true' || needs.changed.outputs.projects_check_config }}
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -55,7 +55,7 @@ jobs:
spellcheck:
name: Spelling
needs: changed
if: ${{ needs.changed.outputs.data == 'true' || needs.changed.outputs.codespell == 'true' || needs.changed.outputs.changelog == 'true' }}
if: ${{ needs.changed.outputs.data == 'true' || needs.changed.outputs.codespell == 'true' || needs.changed.outputs.changelog == 'true' || needs.changed.outputs.projects_check_config }}
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -73,7 +73,7 @@ jobs:
style_check:
name: Style
needs: changed
if: ${{ needs.changed.outputs.editorconfig_files == 'true' }}
if: ${{ needs.changed.outputs.editorconfig_files == 'true' || needs.changed.outputs.projects_check_config }}
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -86,7 +86,7 @@ jobs:
check_coding_style:
name: Code Style
needs: changed
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.code_style_check == 'true' }}
if: ${{ needs.changed.outputs.game_code == 'true' || needs.changed.outputs.unit_tests == 'true' || needs.changed.outputs.code_style_check == 'true' || needs.changed.outputs.projects_check_config }}
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -104,7 +104,7 @@ jobs:
check_content_style:
name: Content Style
needs: changed
if: ${{ needs.changed.outputs.data == 'true' || needs.changed.outputs.content_style_check == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.content_style_script == 'true' }}
if: ${{ needs.changed.outputs.data == 'true' || needs.changed.outputs.content_style_check == 'true' || needs.changed.outputs.integration_tests == 'true' || needs.changed.outputs.content_style_script == 'true' || needs.changed.outputs.projects_check_config }}
tibetiroka marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
Loading