VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-07-06 13:56:29 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-07-06 13:56:29 +0200
commitd8369c266f23fd7054a3a1e3d071cb5fadc27ecd (patch)
tree8843f8e2937eae8c918373110399d7c147bf507d /.github/workflows
parent519b787914ebfc5cf31c2eab384b5f075a47138e (diff)
downloadVeraCrypt-d8369c266f23fd7054a3a1e3d071cb5fadc27ecd.tar.gz
VeraCrypt-d8369c266f23fd7054a3a1e3d071cb5fadc27ecd.zip
Linux: optimize Github workflow by caching wxBuildConsole and wxBuildGUI folders
We also modify build script to detect the presence of wxBuildConsole and wxBuildGUI folders and reuse them
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build-linux.yml52
1 files changed, 43 insertions, 9 deletions
diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml
index 4145835a..dddeb87b 100644
--- a/.github/workflows/build-linux.yml
+++ b/.github/workflows/build-linux.yml
@@ -57,20 +57,30 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Cache wxWidgets
+ - name: Generate cache key
+ id: cache-key
+ run: |
+ echo "cache_key=$(echo ${{ env.WXWIDGETS_VERSION }}-$(sha256sum src/Makefile | awk '{print $1}'))" >> $GITHUB_OUTPUT
+
+ - name: Cache wxBuildConsole
+ uses: actions/cache@v3
+ id: cache-wxbuildconsole
+ with:
+ path: /tmp/wxBuildConsole
+ key: wxBuildConsole-${{ steps.cache-key.outputs.cache_key }}
+
+ - name: Cache wxBuildGUI
uses: actions/cache@v3
- id: cache-wxwidgets
+ id: cache-wxbuildgui
with:
- path: /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}
- key: wxWidgets-${{ env.WXWIDGETS_VERSION }}-${{ hashFiles('src/Build/build_cmake_deb.sh', 'src/Makefile') }}
- restore-keys: |
- wxWidgets-${{ env.WXWIDGETS_VERSION }}-
+ path: /tmp/wxBuildGUI
+ key: wxBuildGUI-${{ steps.cache-key.outputs.cache_key }}
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y wget tar libpcsclite-dev libfuse-dev yasm libgtk-3-dev libwxgtk3.0-gtk3-dev libayatana-appindicator3-dev cmake debhelper
- - name: Download and extract wxWidgets to /tmp
- if: steps.cache-wxwidgets.outputs.cache-hit != 'true'
+ - name: Download and extract wxWidgets to /tmp if build folders are missing
+ if: steps.cache-wxbuildconsole.outputs.cache-hit != 'true' || steps.cache-wxbuildgui.outputs.cache-hit != 'true'
run: |
wget https://github.com/wxWidgets/wxWidgets/releases/download/v${{ env.WXWIDGETS_VERSION }}/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2 -O /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2
mkdir -p /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}
@@ -165,4 +175,28 @@ jobs:
exit 1
fi
sudo veracrypt -d
- sudo apt remove -y veracrypt
+ sudo apt remove -y veracrypt-console
+
+ - name: Cleanup old caches
+ uses: actions/github-script@v6
+ if: always()
+ with:
+ script: |
+ const caches = await github.rest.actions.getActionsCacheList({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ })
+ for (const cache of caches.data.actions_caches) {
+ if (cache.key.startsWith('wxBuildConsole-') || cache.key.startsWith('wxBuildGUI-')) {
+ if (cache.key !== `wxBuildConsole-${{ steps.cache-key.outputs.cache_key }}` &&
+ cache.key !== `wxBuildGUI-${{ steps.cache-key.outputs.cache_key }}`) {
+ console.log(`Deleting cache with key: ${cache.key}`)
+ await github.rest.actions.deleteActionsCacheById({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ cache_id: cache.id,
+ })
+ }
+ }
+ }
+