-
Notifications
You must be signed in to change notification settings - Fork 778
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build.yml: use cache for Docker build envs
- Loading branch information
Showing
1 changed file
with
74 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,21 +102,36 @@ 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 | ||
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 | ||
|
@@ -134,19 +149,34 @@ 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-windows-static-{hash} | ||
restore-keys: | | ||
docker-windows-static- | ||
- 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 | ||
with: | ||
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 | ||
|
@@ -162,19 +192,36 @@ 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-android-static-{hash} | ||
restore-keys: | | ||
docker-android-static- | ||
- 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 | ||
with: | ||
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 | ||
|