Add more caching to the CI

more specificaly to the tarballs download. The function CT_Fetch now
touches the already existing files to be comparable to the not used ones
that can araise when a package is updated.
This comparsion is needed because if it would not exist the tarball
would grow in size due to not used but still cached packages.
This would take time but is definitly something to worry about.

Signed-off-by: Quentin Boswank <qubos@outlook.de>
This commit is contained in:
Quentin Boswank 2023-09-19 19:43:10 +02:00 committed by Chris Packham
parent 591a041865
commit cf6b1740a1
3 changed files with 19 additions and 7 deletions

View File

@ -55,10 +55,12 @@ jobs:
run: | run: |
tar -xf ct-ng.tar tar -xf ct-ng.tar
- name: download tarballs - name: download tarballs
uses: actions/download-artifact@v3 uses: actions/cache/restore@v3
with: with:
name: src.tar path: src.tar
key: src.tar-${{ hashFiles('.local/share/crosstool-ng/packages') }}-${{ hashFiles('.local/share/crosstool-ng/samples') }}
- name: extract tarballs - name: extract tarballs
continue-on-error: true
run: | run: |
tar -xvf src.tar tar -xvf src.tar
- name: prereq Linux - name: prereq Linux

View File

@ -61,6 +61,19 @@ jobs:
- name: "extract ct-ng" - name: "extract ct-ng"
run: | run: |
tar -xf ct-ng.tar tar -xf ct-ng.tar
- name: cache tarballs
id: cache
uses: actions/cache@v3
with:
path: src.tar
key: src.tar-${{ hashFiles('.local/share/crosstool-ng/packages') }}-${{ hashFiles('.local/share/crosstool-ng/samples') }}
restore-keys: |
src.tar-${{ hashFiles('.local/share/crosstool-ng/packages') }}-
src.tar-
- name: extract tarballs
run: |
tar -xvf src.tar || true
touch stamp
- name: "prereq Linux" - name: "prereq Linux"
if: ${{ runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' }}
run: | run: |
@ -82,12 +95,8 @@ jobs:
ct-ng olddefconfig; \ ct-ng olddefconfig; \
ct-ng source; \ ct-ng source; \
done done
find src -type f -not -newer stamp -delete -print
tar -cvf src.tar src tar -cvf src.tar src
- name: "upload sources"
uses: actions/upload-artifact@v3
with:
name: src.tar
path: src.tar
toolchains: toolchains:
needs: [crosstool, tarballs] needs: [crosstool, tarballs]

View File

@ -956,6 +956,7 @@ CT_GetFile()
# Do we already have it in *our* tarballs dir? # Do we already have it in *our* tarballs dir?
if [ -r "${CT_TARBALLS_DIR}/${basename}${ext}" ]; then if [ -r "${CT_TARBALLS_DIR}/${basename}${ext}" ]; then
CT_DoLog DEBUG "Already have '${CT_TARBALLS_DIR}/${basename}${ext}'" CT_DoLog DEBUG "Already have '${CT_TARBALLS_DIR}/${basename}${ext}'"
touch "${CT_TARBALLS_DIR}/${basename}${ext}" # for CI
return 0 return 0
fi fi