What I am trying to do is basically an assembly line: every job must build/maniuplate the provided files, the cache, that is passed to the following job.
This is my workflow:
jobs:
Job1_-_Prepearing_enviornment:
runs-on: ubuntu-latest
steps:
- 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
run: echo "${{ steps.extract_branch.outputs.branch }}-${{ steps.date.outputs.date }}"
outputs:
buildID: "${{ steps.extract_branch.outputs.branch }}-${{ steps.date.outputs.date }}"
# In the last 3 steps I am generating a build specific key in order to not be confused with other running workflows
Job2_-_Downloading_Sources:
runs-on: ubuntu-latest
needs: [Job1_-_Prepearing_enviornment]
steps:
# Here I download a global cache if it's existing (I am generating the global cache in a job not copypasted here)
- uses: actions/download-artifact@v2
with:
name: global-cache
continue-on-error: true
- uses: actions/checkout@v3
- name: Downloading sources
run: |
git pull
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
sudo flatpak-builder --download-only --user --repo=local retrodeck-flatpak net.retrodeck.retrodeck.yml
# Here I am using the key generated in the Job1 to save the cache
- name: Generating build specific cache
id: intenral-cache
uses: actions/cache@v2
with:
path: /home/runner/work/RetroDECK
key: ${{ needs.Job1_-_Prepearing_enviornment.outputs.buildID }}
Job3_-_Building_part_1:
runs-on: ubuntu-latest
needs: [Job1_-_Prepearing_enviornment, Job2_-_Downloading_Sources]
steps:
# Here I am supposed to get the internal cache calling its key but this process is not working and the build stops
- name: cache-cooker
id: internal-cache
uses: actions/cache@v2
with:
path: /home/runner/work/RetroDECK
key: ${{ needs.Job1_-_Prepearing_enviornment.outputs.buildID }}
- name: Initializing 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
- name: Bulding part 1 - Until melonds
run: |
cd /home/runner/work/RetroDECK/RetroDECK
sudo flatpak-builder --build-only --stop-at=melonds --user --repo=local retrodeck-flatpak net.retrodeck.retrodeck.yml
As you can see from the comments in the code, the job3 cannot get the cache and I get this output from the GitAction log:
Run actions/cache@v2
with:
path: /home/runner/work/RetroDECK
key: cooker-20220502_115338
Cache not found for input keys: cooker-20220502_115338
Then the job fails because it cannot find the needed files.
I am trying to use the Artifacts instead of the cache but it's too slow by zipping, uploading, downloading and unzipping, so maybe the cache it's a more straightforward way.
What am I doing wrong?
How can I fix this?
Thanks in advance.