Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
# Runs separately so the build jobs, which also run for pull requests, do not need actions: write.
cleanup-ccache:
name: Delete Superseded Compiler Caches
needs: [build-generals-vc6, build-generals-win32, build-generalsmd-vc6, build-generalsmd-win32]
needs: [build-generals-vc6, build-generals-win32, build-generalsmd-vc6, build-generalsmd-win32, build-mingw-generals, build-mingw-generalsmd]
if: ${{ !cancelled() && github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
Expand Down
40 changes: 39 additions & 1 deletion .github/workflows/reusable-build-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install MinGW-w64 Toolchain
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 cmake
sudo apt-get install -y mingw-w64 cmake ccache

- name: Install Wine and widl
run: |
Expand Down Expand Up @@ -58,9 +58,32 @@ jobs:
path: build/${{ inputs.preset }}/_deps
key: cmake-deps-mingw-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}

- name: Set Up ccache
id: ccache
run: |
echo "CCACHE_DIR=$RUNNER_TEMP/ccache-cache" >> "$GITHUB_ENV"
# Runner image updates can change timestamps without changing the compiler.
echo "CCACHE_COMPILERCHECK=content" >> "$GITHUB_ENV"
# Bound each game/preset cache to limit storage across the build matrix.
echo "CCACHE_MAXSIZE=500M" >> "$GITHUB_ENV"
echo "toolchain=$(i686-w64-mingw32-g++ -dumpfullversion)" >> "$GITHUB_OUTPUT"

- name: Restore MinGW-w64 Compilation Cache
id: ccache-restore
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ inputs.game }}-${{ inputs.preset }}-${{ steps.ccache.outputs.toolchain }}-${{ github.sha }}
restore-keys: |
ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ inputs.game }}-${{ inputs.preset }}-${{ steps.ccache.outputs.toolchain }}-

- name: Configure ${{ inputs.game }} with CMake (${{ inputs.preset }})
run: |
# GCC PCH consumers bypass ccache unless time-macro checking is relaxed.
cmake --preset ${{ inputs.preset }} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \
-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }} \
-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }} \
-DRTS_BUILD_CORE_TOOLS=OFF \
Expand All @@ -70,9 +93,24 @@ jobs:
-DRTS_BUILD_GENERALS_EXTRAS=OFF \
-DRTS_BUILD_ZEROHOUR_EXTRAS=OFF

- name: Reset ccache Statistics
run: ccache --zero-stats

- name: Build ${{ inputs.game }} (${{ inputs.preset }})
run: cmake --build build/${{ inputs.preset }} --target ${{ inputs.game == 'Generals' && 'g_generals' || 'z_generals' }} -j$(nproc)

- name: Show ccache Statistics
if: ${{ always() }}
run: ccache --show-stats --verbose

# Pull requests only restore, so caches change only after changes reach main.
- name: Save MinGW-w64 Compilation Cache
if: ${{ github.event_name != 'pull_request' && steps.ccache-restore.outputs.cache-hit != 'true' }}
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}

- name: Collect ${{ inputs.game }} Artifacts
run: |
ARTIFACTS_DIR="build/${{ inputs.preset }}/${{ inputs.game }}/artifacts"
Expand Down
Loading