Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.yml: use cache for Docker build envs #4367

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 73 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,37 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: satackey/[email protected]
if: "!startsWith(github.ref, 'refs/tags/v')"
continue-on-error: true
with:
key: docker-linux-static-{hash}
restore-keys: |
docker-linux-static-
- name: install dependencies
run: sudo apt -y install xvfb libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xkb1 libxcb-shape0 libxkbcommon-x11-0
- name: get Dockerfile.linux hash
id: dockerfile_linux_hash
run: echo "hash=$(sha256sum Dockerfile.linux | awk '{ print $1 }')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: docker_cache
if: "!startsWith(github.ref, 'refs/tags/v')"
with:
path: /tmp/linux-docker-image
key: linux-docker-${{ steps.dockerfile_linux_hash.outputs.hash }}
- name: free up diskspace
run: ${{env.FREE_DISKSPACE}}
- name: load cached docker build env image
if: steps.docker_cache.outputs.cache-hit == 'true'
run: docker load -i /tmp/linux-docker-image/image.tar
- name: prepare build environment
run: docker build --tag monero:build-env-linux --build-arg THREADS=3 --file Dockerfile.linux .
run: |
if [[ "$(docker images -q monero:build-env-linux 2> /dev/null)" == "" ]]; then
echo "Building new image..."
docker build --tag monero:build-env-linux --build-arg THREADS=4 --file Dockerfile.linux .
else
echo "Using cached image..."
fi
- name: save build env image to cache
if: steps.docker_cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/linux-docker-image
docker save monero:build-env-linux > /tmp/linux-docker-image/image.tar
- name: build
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j3'
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'make release-static -j4'
- name: sha256sum
run: shasum -a256 /home/runner/work/monero-gui/monero-gui/build/release/bin/monero-wallet-gui
- name: test qml
Expand All @@ -134,19 +150,35 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: satackey/[email protected]
- name: get Dockerfile.windows hash
id: dockerfile_windows_hash
run: echo "hash=$(sha256sum Dockerfile.windows | awk '{ print $1 }')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: docker_cache
if: "!startsWith(github.ref, 'refs/tags/v')"
continue-on-error: true
with:
key: docker-windows-static-{hash}
restore-keys: |
docker-windows-static-
path: /tmp/windows-docker-image
key: windows-docker-${{ steps.dockerfile_windows_hash.outputs.hash }}
- name: free up diskspace
run: ${{env.FREE_DISKSPACE}}
- name: load cached docker build env image
if: steps.docker_cache.outputs.cache-hit == 'true'
run: docker load -i /tmp/windows-docker-image/image.tar
- name: prepare build environment
run: docker build --tag monero:build-env-windows --build-arg THREADS=3 --file Dockerfile.windows .
run: |
if [[ "$(docker images -q monero:build-env-windows 2> /dev/null)" == "" ]]; then
echo "Building new image..."
docker build --tag monero:build-env-windows --build-arg THREADS=4 --file Dockerfile.windows .
else
echo "Using cached image..."
fi
- name: save build env image to cache
if: steps.docker_cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/windows-docker-image
docker save monero:build-env-windows > /tmp/windows-docker-image/image.tar
- name: build
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -w /monero-gui monero:build-env-windows sh -c 'make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j3'
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -w /monero-gui monero:build-env-windows sh -c 'make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j4'
- name: sha256sum
run: shasum -a256 /home/runner/work/monero-gui/monero-gui/build/x86_64-w64-mingw32/release/bin/monero-wallet-gui.exe
- uses: actions/upload-artifact@v4
Expand All @@ -162,19 +194,37 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: satackey/[email protected]
- name: get Dockerfile.android hash
id: dockerfile_android_hash
run: echo "hash=$(sha256sum Dockerfile.android | awk '{ print $1 }')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: docker_cache
if: "!startsWith(github.ref, 'refs/tags/v')"
continue-on-error: true
with:
key: docker-android-static-{hash}
restore-keys: |
docker-android-static-
path: /tmp/android-docker-image
key: android-docker-${{ steps.dockerfile_android_hash.outputs.hash }}
- name: free up diskspace
run: ${{env.FREE_DISKSPACE}}
- name: load cached docker build env image
if: steps.docker_cache.outputs.cache-hit == 'true'
run: docker load -i /tmp/android-docker-image/image.tar
- name: prepare build environment
run: docker build --tag monero:build-env-android --build-arg THREADS=3 --file Dockerfile.android .
run: |
if [[ "$(docker images -q monero:build-env-android 2> /dev/null)" == "" ]]; then
echo "Building new image..."
docker build --tag monero:build-env-android --build-arg THREADS=4 --file Dockerfile.android .
else
echo "Using cached image..."
fi
- name: save build env image to cache
if: steps.docker_cache.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/android-docker-image
docker save monero:build-env-android > /tmp/android-docker-image/image.tar
- name: build
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -e THREADS=3 monero:build-env-android
run: docker run --rm -v /home/runner/work/monero-gui/monero-gui:/monero-gui -e THREADS=4 monero:build-env-android
- name: free up diskspace
run: ${{env.FREE_DISKSPACE}}
- name: Remove obsolete docker layers
run: docker images -a | grep none | awk '{ print $3; }' | xargs docker rmi || true
- uses: actions/upload-artifact@v4
Expand Down
Loading