Skip to content

Commit

Permalink
Infrastructre: reformat cache save action (Mudlet#7545)
Browse files Browse the repository at this point in the history
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Reformat cache save action to use the recommended
https://github.com/actions/cache/tree/main/save#always-save-cache way
#### Motivation for adding to Mudlet
Removing a build warning
#### Other info (issues closed, discussion etc)

---------

Co-authored-by: Vadim Peretokin <[email protected]>
  • Loading branch information
vadi2 and vadi2 authored Dec 11, 2024
1 parent 89b88a3 commit 6664f4c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build-mudlet-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ jobs:
$GITHUB_WORKSPACE/CI/setup-windows-sdk.sh
$GITHUB_WORKSPACE/CI/validate-deployment-for-windows.sh
- name: restore ccache
uses: actions/cache@v4
- name: Restore ccache
id: restore-ccache
uses: actions/cache/restore@v4
with:
path: ${{runner.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.buildname}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.buildname}}
save-always: true

- name: (Windows) Build
shell: msys2 {0}
Expand All @@ -73,6 +73,13 @@ jobs:
GITHUB_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: $GITHUB_WORKSPACE/CI/build-mudlet-for-windows.sh

- name: Save ccache
if: always() && steps.restore-ccache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{runner.workspace}}/ccache
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}

- name: (Windows) Package
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/package-mudlet-for-windows.sh
Expand Down Expand Up @@ -114,9 +121,6 @@ jobs:
name: ${{env.UPLOAD_FILENAME}}
path: ${{env.FOLDER_TO_UPLOAD}}

#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3

- name: Submit to make.mudlet.org
if: env.UPLOAD_FILENAME
run: |
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/build-mudlet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,16 @@ jobs:
modules: ${{ startsWith(matrix.qt, '6') && 'qt5compat qtmultimedia' || '' }}

- name: Restore Boost cache
uses: actions/cache@v4
id: cache-boost
id: restore-boost
uses: actions/cache/restore@v4
with:
path: ${{env.BOOST_ROOT}}
key: boost

- name: Install Boost
if: steps.cache-boost.outputs.cache-hit != 'true'
if: steps.restore-boost.outputs.cache-hit != 'true'
run: |
if [ "$OS" == "Windows_NT" ]; then
# fix up paths to be forward slashes consistently
BOOST_ROOT=$(echo $BOOST_ROOT | sed 's/\\/\//g')
fi
mkdir -p $BOOST_ROOT
Expand All @@ -97,6 +96,12 @@ jobs:
rm -rf boost_*/* download.tar.bz2 download.tar
shell: bash

- name: Save Boost cache
if: steps.restore-boost.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{env.BOOST_ROOT}}
key: ${{ steps.restore-boost.outputs.cache-primary-key }}

- name: Use CMake 3.30.3
uses: lukka/[email protected]
Expand Down Expand Up @@ -256,13 +261,13 @@ jobs:
echo "WITH_3DMAPPER=no" >> $GITHUB_ENV
echo "WITH_FONTS=no" >> $GITHUB_ENV
- name: restore ccache
uses: actions/cache@v4
- name: Restore ccache
id: restore-ccache
uses: actions/cache/restore@v4
with:
path: ${{runner.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}
save-always: true

- name: (Linux) Set build info
if: runner.os == 'Linux'
Expand Down Expand Up @@ -297,15 +302,20 @@ jobs:
cmakeListsTxtPath: '${{github.workspace}}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{runner.workspace}}/b/ninja'
# enable for a debug build (1/2)
# buildWithCMakeArgs: --config RelWithDebInfo
cmakeAppendedArgs: >-
-G Ninja
-DCMAKE_PREFIX_PATH=${{ env.QT_PREFIX != '' && env.QT_PREFIX || env.MINGW_BASE_DIR }}
-DVCPKG_APPLOCAL_DEPS=OFF
env:
NINJA_STATUS: '[%f/%t %o/sec] '

- name: Save ccache
if: always() && steps.restore-ccache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{runner.workspace}}/ccache
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}

- name: Upload GitHub Actions artifact of vcpkg build logs
if: failure()
uses: actions/upload-artifact@v4
Expand All @@ -321,13 +331,6 @@ jobs:
working-directory: '${{runner.workspace}}/b/ninja'
run: ctest --output-on-failure

- name: restore Luarocks for packaging
uses: actions/cache@v4
with:
path: $HOME/.luarocks
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{hashFiles('.github/workflows/build-mudlet.yml')}}
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-

- name: install dependencies for packaging/tests
if: matrix.deploy == 'deploy' || matrix.run_tests == 'true'
run: |
Expand Down

0 comments on commit 6664f4c

Please sign in to comment.