Skip to content

Commit

Permalink
Proper cache, cached dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: bakhtin <[email protected]>
  • Loading branch information
bakhtin committed Oct 10, 2024
1 parent ac5d21a commit 16c45a3
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
env:
ARTIFACTS_LIST: | # artifacts to upload, one per line
cvm-image-azure-tdx.rootfs.wic
ARTIFACTS_DIR: reproducible-build/artifacts
BB_ENV_PASSTHROUGH_ADDITIONS: "DL_DIR SSTATE_DIR"
BITBAKE_CACHE: "${HOME}/bitbake-cache"
DL_DIR: "${BITBAKE_CACHE}/downloads"
SSTATE_DIR: "${BITBAKE_CACHE}/sstate"

jobs:
release:
Expand All @@ -19,22 +24,26 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Create cache dir
run: |
mkdir -p ${DL_DIR} ${SSTATE_DIR}
- name: Restore cached build dependencies
id: cache-build-restore
uses: WarpBuilds/cache/restore@v1
with:
path: build
key: ${{ runner.os }}-yocto-manifests-build
path: ${{ env.BITBAKE_CACHE }}
key: ${{ runner.os }}-yocto-manifests

- name: build
- name: Build
run: |
make azure-image
- name: Cache build dependencies
id: cache-build-save
uses: WarpBuilds/cache/save@v1
with:
path: build
path: ${{ env.BITBAKE_CACHE }}
key: ${{ steps.cache-build-restore.outputs.cache-primary-key }}

- name: Install rclone
Expand All @@ -43,12 +52,17 @@ jobs:
sudo dpkg -i rclone.deb
rm -f rclone.deb
# - name: Create test artifact # TODO: remove
# run: |
# mkdir -p reproducible-build/artifacts
# echo "test artifact" > ./reproducible-build/artifacts/cvm-image-azure-tdx.rootfs-20241002143710.wic
# echo "test artifact 2" > ./reproducible-build/artifacts/cvm-image-azure-tdx.rootfs.wic.test
# ln -rs ./reproducible-build/artifacts/cvm-image-azure-tdx.rootfs-20241002143710.wic ./reproducible-build/artifacts/cvm-image-azure-tdx.rootfs.wic
- name: Resolve real paths of artifacts
run: |
REALPATH_ARTIFACTS_LIST=$(find ${ARTIFACTS_DIR} -maxdepth 1 -exec realpath {} \;)
echo "REALPATH_ARTIFACTS_LIST=$REALPATH_ARTIFACTS_LIST" >> $GITHUB_ENV
- name: Calculate hashsums of artifacts
run: |
cd ${ARTIFACTS_DIR}
for artifact in $REALPATH_ARTIFACTS_LIST; do
sha256sum $artifact > $artifact.sha256
done
- name: Upload build artifacts
env:
Expand All @@ -72,8 +86,8 @@ jobs:
TODAY_DATE=$(date +"%Y/%m/%d")
rclone copy -v --transfers=4 --s3-upload-concurrency=20 \
--contimeout=1m --retries 3 --retries-sleep 30s \
--fast-list --checksum --copy-links --files-from <(echo "$ARTIFACTS_LIST") \
reproducible-build/artifacts \
--fast-list --checksum --copy-links --files-from <(echo "$REALPATH_ARTIFACTS_LIST") \
${ARTIFACTS_DIR} \
r2:flashbots-public-artifacts/tdx-vm-images/$TODAY_DATE
# Sync today's artifacts to latest
Expand All @@ -92,6 +106,3 @@ jobs:
UPLOADED_ARTIFACTS_COUNT=$(echo "$UPLOADED_ARTIFACTS_STATS" | jq '.count')
echo "✅ Successfully uploaded $UPLOADED_ARTIFACTS_COUNT artifacts (total size $UPLOADED_ARTIFACTS_SIZE):"
echo "$ARTIFACTS_LIST"
# - name: Setup ssh session
# uses: Warpbuilds/[email protected]

0 comments on commit 16c45a3

Please sign in to comment.