Skip to content

Commit

Permalink
workflows get rid of ccache manual downloading
Browse files Browse the repository at this point in the history
Used version from package manager, removed the URL_CCACHE_LINUX_X64.
  • Loading branch information
silverqx committed Jun 10, 2024
1 parent 3b38a84 commit f5608ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 171 deletions.
59 changes: 3 additions & 56 deletions .github/workflows/linux-qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,70 +177,17 @@ jobs:
run: |
sudo apt update
- name: apt install ${{ join(matrix.compiler.apt, ', ') }}, and Qt 5.15.3 base
- name: apt install ${{ join(matrix.compiler.apt, ', ') }}, Qt 5.15.3 base, and ccache
run: >-
sudo apt install --yes ${{ join(matrix.compiler.apt, ' ') }}
qtbase5-dev libqt5sql5-mysql libqt5sql5-sqlite libqt5sql5-psql
qtbase5-dev libqt5sql5-mysql libqt5sql5-sqlite libqt5sql5-psql ccache
# No need to use lukka/get-cmake, these images always have latest version
- name: Ninja install latest version
uses: seanmiddleditch/gha-setup-ninja@master
with:
destination: ${{ env.TinyRunnerWorkPath }}/ninja-build

- name: Ccache initialize download
id: downloads-initialize-ccache
run: |
filename=$(basename "$URL_CCACHE_LINUX_X64")
echo "Filename=$filename" >> $GITHUB_OUTPUT
filepath="${{ runner.temp }}/$filename"
echo "Filepath=$filepath" >> $GITHUB_OUTPUT
hash=$(wget "$URL_CACHE_HASH_LINUX" -O- --no-verbose --quiet)
echo "Hash=$hash" >> $GITHUB_OUTPUT
env:
URL_CACHE_HASH_LINUX: ${{ secrets.URL_CACHE_HASH_LINUX }}
URL_CCACHE_LINUX_X64: ${{ secrets.URL_CCACHE_LINUX_X64 }}

- name: Ccache restore cache (download)
uses: actions/cache@v3
id: downloads-cache-ccache
with:
path: ${{ env.archive_filepath }}
key: ${{ runner.os }}-caches-${{ env.cache_name }}-${{ env.cache_hash }}
env:
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}
cache_hash: ${{ steps.downloads-initialize-ccache.outputs.Hash }}
cache_name: ccache

- name: Ccache download
if: steps.downloads-cache-ccache.outputs.cache-hit != 'true'
run: |
wget "$URL_CCACHE_LINUX_X64" --output-document="$archive_filepath" --no-verbose
env:
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}
URL_CCACHE_LINUX_X64: ${{ secrets.URL_CCACHE_LINUX_X64 }}

- name: Ccache install
run: |
echo '::group::Extract archive'
tar xJvf "$archive_filepath" --directory '${{ runner.temp }}'
echo '::endgroup::'
echo '::group::Install'
extractedFolder=$(basename --suffix='.tar.xz' "$archive_filename")
cd "${{ runner.temp }}/$extractedFolder"
sudo make install
echo '::endgroup::'
echo '::group::Print version'
ccache --version
echo '::endgroup::'
env:
archive_filename: ${{ steps.downloads-initialize-ccache.outputs.Filename }}
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}

- name: Ccache initialize
id: ccache-initialize-cache
run: |
Expand Down Expand Up @@ -304,7 +251,7 @@ jobs:
-S .
-B ../TinyORM-builds-cmake/build-${{ matrix.compiler.key }}-cmake-debug
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=/usr/local/bin/ccache
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache
-D CMAKE_CXX_COMPILER:FILEPATH=${{ matrix.compiler.command }}
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
Expand Down
59 changes: 3 additions & 56 deletions .github/workflows/linux-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -537,70 +537,17 @@ jobs:
run: |
sudo apt update
- name: apt install ${{ join(matrix.compiler.apt, ', ') }}, and Qt 6.2.4 base
- name: apt install ${{ join(matrix.compiler.apt, ', ') }}, Qt 6.2.4 base, and ccache
run: >-
sudo apt install --yes ${{ join(matrix.compiler.apt, ' ') }}
qt6-base-dev libqt6sql6-mysql libqt6sql6-sqlite libqt6sql6-psql
qt6-base-dev libqt6sql6-mysql libqt6sql6-sqlite libqt6sql6-psql ccache
# No need to use lukka/get-cmake, these images always have latest version
- name: Ninja install latest version
uses: seanmiddleditch/gha-setup-ninja@master
with:
destination: ${{ env.TinyRunnerWorkPath }}/ninja-build

- name: Ccache initialize download
id: downloads-initialize-ccache
run: |
filename=$(basename "$URL_CCACHE_LINUX_X64")
echo "Filename=$filename" >> $GITHUB_OUTPUT
filepath="${{ runner.temp }}/$filename"
echo "Filepath=$filepath" >> $GITHUB_OUTPUT
hash=$(wget "$URL_CACHE_HASH_LINUX" -O- --no-verbose --quiet)
echo "Hash=$hash" >> $GITHUB_OUTPUT
env:
URL_CACHE_HASH_LINUX: ${{ secrets.URL_CACHE_HASH_LINUX }}
URL_CCACHE_LINUX_X64: ${{ secrets.URL_CCACHE_LINUX_X64 }}

- name: Ccache restore cache (download)
uses: actions/cache@v3
id: downloads-cache-ccache
with:
path: ${{ env.archive_filepath }}
key: ${{ runner.os }}-caches-${{ env.cache_name }}-${{ env.cache_hash }}
env:
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}
cache_hash: ${{ steps.downloads-initialize-ccache.outputs.Hash }}
cache_name: ccache

- name: Ccache download
if: steps.downloads-cache-ccache.outputs.cache-hit != 'true'
run: |
wget "$URL_CCACHE_LINUX_X64" --output-document="$archive_filepath" --no-verbose
env:
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}
URL_CCACHE_LINUX_X64: ${{ secrets.URL_CCACHE_LINUX_X64 }}

- name: Ccache install
run: |
echo '::group::Extract archive'
tar xJvf "$archive_filepath" --directory '${{ runner.temp }}'
echo '::endgroup::'
echo '::group::Install'
extractedFolder=$(basename --suffix='.tar.xz' "$archive_filename")
cd "${{ runner.temp }}/$extractedFolder"
sudo make install
echo '::endgroup::'
echo '::group::Print version'
ccache --version
echo '::endgroup::'
env:
archive_filename: ${{ steps.downloads-initialize-ccache.outputs.Filename }}
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}

- name: Ccache initialize
id: ccache-initialize-cache
run: |
Expand Down Expand Up @@ -663,7 +610,7 @@ jobs:
-S .
-B ../TinyORM-builds-cmake/build-${{ matrix.compiler.key }}-cmake-debug
-G Ninja
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=/usr/local/bin/ccache
-D CMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache
-D CMAKE_CXX_COMPILER:FILEPATH=${{ matrix.compiler.command }}
-D CMAKE_TOOLCHAIN_FILE:FILEPATH="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-D CMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON
Expand Down
62 changes: 3 additions & 59 deletions .github/workflows/vcpkg-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ jobs:
run: |
sudo apt update
- name: apt install g++-12
- name: apt install g++-12 and ccache
if: env.TinyIsSelfHostedRunner == 'false'
run: |
sudo apt install --yes g++-12
sudo apt install --yes g++-12 ccache
# Qt5 build dependencies: https://wiki.qt.io/Building_Qt_5_from_Git
- name: apt install Qt5 build dependencies
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
- name: apt install Qt v${{ matrix.qt.version }} base (${{ join(matrix.compiler.apt, ', ') }})
if: env.TinyIsSelfHostedRunner == 'false'
run: |
sudo apt install --yes ${{ join(matrix.qt.apt, ' ') }}
sudo apt install --yes ${{ join(matrix.qt.apt, ' ') }} ccache
# Prepare ccache
#
Expand All @@ -330,62 +330,6 @@ jobs:
ccacheDirPath=$(realpath '${{ runner.workspace }}/ccache')
echo "CCACHE_DIR=$ccacheDirPath" >> $GITHUB_ENV
- name: Ccache initialize download
if: env.TinyIsSelfHostedRunner == 'false'
id: downloads-initialize-ccache
run: |
filename=$(basename "$URL_CCACHE_LINUX_X64")
echo "Filename=$filename" >> $GITHUB_OUTPUT
filepath="${{ runner.temp }}/$filename"
echo "Filepath=$filepath" >> $GITHUB_OUTPUT
hash=$(wget "$URL_CACHE_HASH_LINUX" -O- --no-verbose --quiet)
echo "Hash=$hash" >> $GITHUB_OUTPUT
env:
URL_CACHE_HASH_LINUX: ${{ secrets.URL_CACHE_HASH_LINUX }}
URL_CCACHE_LINUX_X64: ${{ secrets.URL_CCACHE_LINUX_X64 }}

- name: Ccache restore cache (download)
if: env.TinyIsSelfHostedRunner == 'false'
uses: actions/cache@v3
id: downloads-cache-ccache
with:
path: ${{ env.archive_filepath }}
key: ${{ runner.os }}-caches-${{ env.cache_name }}-${{ env.cache_hash }}
env:
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}
cache_hash: ${{ steps.downloads-initialize-ccache.outputs.Hash }}
cache_name: ccache

- name: Ccache download
if: env.TinyIsSelfHostedRunner == 'false' && steps.downloads-cache-ccache.outputs.cache-hit != 'true'
run: |
wget "$URL_CCACHE_LINUX_X64" --output-document="$archive_filepath" --no-verbose
env:
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}
URL_CCACHE_LINUX_X64: ${{ secrets.URL_CCACHE_LINUX_X64 }}

- name: Ccache install
if: env.TinyIsSelfHostedRunner == 'false'
run: |
echo '::group::Extract archive'
tar xJvf "$archive_filepath" --directory '${{ runner.temp }}'
echo '::endgroup::'
echo '::group::Install'
extractedFolder=$(basename --suffix='.tar.xz' "$archive_filename")
cd "${{ runner.temp }}/$extractedFolder"
sudo make install
echo '::endgroup::'
echo '::group::Print version'
ccache --version
echo '::endgroup::'
env:
archive_filename: ${{ steps.downloads-initialize-ccache.outputs.Filename }}
archive_filepath: ${{ steps.downloads-initialize-ccache.outputs.Filepath }}

- name: Ccache initialize
if: env.TinyIsSelfHostedRunner == 'false'
id: ccache-initialize-cache
Expand Down

0 comments on commit f5608ee

Please sign in to comment.