From 09972b9bb95905178dfa078b48c57ff7289990bb Mon Sep 17 00:00:00 2001 From: Xargon Wan Date: Sun, 1 May 2022 22:43:26 +0900 Subject: [PATCH] First try on internal/global cache --- .github/workflows/cooker.yml | 91 ++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/.github/workflows/cooker.yml b/.github/workflows/cooker.yml index 4bb9cf7a..296fb6fe 100644 --- a/.github/workflows/cooker.yml +++ b/.github/workflows/cooker.yml @@ -15,41 +15,38 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + jobs: - # Job1_-_Prepearing_enviornment: - # runs-on: ubuntu-latest - # steps: - # # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - # - uses: actions/checkout@v3 - # - name: Prepearing enviornment - # run: | - # git submodule init - # git submodule update - # sudo add-apt-repository ppa:alexlarsson/flatpak - # sudo apt-get update - # sudo apt install flatpak flatpak-builder p7zip-full - # sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - # sudo flatpak install -y org.kde.Sdk//5.15-21.08 org.kde.Platform//5.15-21.08 io.qt.qtwebengine.BaseApp/x86_64/5.15-21.08 org.freedesktop.Sdk.Extension.llvm13 + Job1_-_Prepearing_enviornment: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it+++++++++++++++++++++++++++++++++++ - # - name: cache-cooker - # id: cache-cooker - # uses: actions/cache@v2 - # with: - # path: /home/runner/work/RetroDECK - # key: ${{ runner.os }}-cooker-cache + - name: Get date for artifacts + id: date + run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M%S')" + + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - name: Generating build ID + id: buildID + run: echo "${{ steps.extract_branch.outputs.branch }}-${{ steps.date.outputs.date }}" Job2_-_Downloading_Sources: runs-on: ubuntu-latest - #needs: [Job1_-_Prepearing_enviornment] + needs: [Job1_-_Prepearing_enviornment] steps: - - name: cache-cooker - id: cache-cooker + - name: Retrieve previous cache + id: global-cache uses: actions/cache@v2 with: - path: /home/runner/work/RetroDECK - key: ${{ runner.os }}-cooker-cache + path: /home/runner/work/RetroDECK + key: cooker-global-cache - uses: actions/checkout@v3 @@ -66,6 +63,13 @@ jobs: sudo flatpak install -y org.kde.Sdk//5.15-21.08 org.kde.Platform//5.15-21.08 io.qt.qtwebengine.BaseApp/x86_64/5.15-21.08 org.freedesktop.Sdk.Extension.llvm13 sudo flatpak-builder --download-only --user --install --force-clean --repo=local retrodeck-flatpak net.retrodeck.retrodeck.yml + - name: Generating build specific cache + id: intenral-cache + uses: actions/cache@v2 + with: + path: /home/runner/work/RetroDECK + key: jobs.Job1_-_Prepearing_enviornment.steps.buildID + # - name: Continuing with previous worklow cache # if: steps.cache-cooker.outputs.cache-hit == 'true' # run: | @@ -87,11 +91,11 @@ jobs: #- uses: actions/checkout@v3 - name: cache-cooker - id: cache-cooker + id: internal-cache uses: actions/cache@v2 with: - path: /home/runner/work/RetroDECK - key: ${{ runner.os }}-cooker-cache + path: /home/runner/work/RetroDECK + key: jobs.Job1_-_Prepearing_enviornment.steps.buildID - name: Initializing enviornment #if: steps.cache-cooker.outputs.cache-hit != 'true' @@ -117,11 +121,11 @@ jobs: #- uses: actions/checkout@v3 - name: cache-cooker - id: cache-cooker + id: internal-cache uses: actions/cache@v2 with: - path: /home/runner/work/RetroDECK - key: ${{ runner.os }}-cooker-cache + path: /home/runner/work/RetroDECK + key: jobs.Job1_-_Prepearing_enviornment.steps.buildID - name: Initializing enviornment #if: steps.cache-cooker.outputs.cache-hit != 'true' @@ -147,11 +151,11 @@ jobs: #- uses: actions/checkout@v3 - name: cache-cooker - id: cache-cooker + id: internal-cache uses: actions/cache@v2 with: - path: /home/runner/work/RetroDECK - key: ${{ runner.os }}-cooker-cache + path: /home/runner/work/RetroDECK + key: jobs.Job1_-_Prepearing_enviornment.steps.buildID - name: Initializing enviornment #if: steps.cache-cooker.outputs.cache-hit != 'true' @@ -177,11 +181,11 @@ jobs: #- uses: actions/checkout@v3 - name: cache-cooker - id: cache-cooker + id: internal-cache uses: actions/cache@v2 with: - path: /home/runner/work/RetroDECK - key: ${{ runner.os }}-cooker-cache + path: /home/runner/work/RetroDECK + key: jobs.Job1_-_Prepearing_enviornment.steps.buildID - name: Initializing enviornment #if: steps.cache-cooker.outputs.cache-hit != 'true' @@ -206,11 +210,11 @@ jobs: steps: - name: cache-cooker - id: cache-cooker + id: internal-cache uses: actions/cache@v2 with: - path: /home/runner/work/RetroDECK - key: ${{ runner.os }}-cooker-cache + path: /home/runner/work/RetroDECK + key: jobs.Job1_-_Prepearing_enviornment.steps.buildID - name: Get date for artifacts id: date @@ -240,6 +244,13 @@ jobs: token: ${{ secrets.TRIGGER_BUILD_TOKEN }} repo: RetroDECK-cooker + - name: Regenerate global cache + id: global-cache + uses: actions/cache@v2 + with: + path: /home/runner/work/RetroDECK + key: cooker-global-cache + # Job8_-_Uploading_cache: # runs-on: ubuntu-latest # needs: [Job7_-_Publishing_flatpak]