forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'lukas/gh/refactor-build-base-image' into maint
* lukas/gh/refactor-build-base-image: gh: Update cached branch to 26 gh: Refactor build-base-image to composite image
- Loading branch information
Showing
3 changed files
with
85 additions
and
185 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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build Base Image | ||
description: 'Builds the base testing image (using cache if possible)' | ||
|
||
inputs: | ||
BASE_BRANCH: | ||
required: true | ||
TYPE: | ||
default: '64-bit' | ||
BUILD_IMAGE: | ||
default: true | ||
github_token: | ||
description: 'GITHUB_TOKEN' | ||
default: '${{ github.token }}' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Cleanup GH Runner | ||
shell: bash -euxo pipefail {0} | ||
run: | | ||
## Delete large files from runner to get more disk space | ||
## See https://github.com/actions/runner-images/issues/2840 | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf "/usr/local/share/boost" | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
- name: Cache BASE image | ||
uses: actions/cache@v3 | ||
if: inputs.TYPE == '64-bit' || inputs.TYPE == 'clang' | ||
with: | ||
path: otp_docker_base.tar | ||
key: ${{ runner.os }}-${{ hashFiles('.github/dockerfiles/Dockerfile.ubuntu-base', '.github/scripts/build-base-image.sh') }}-${{ hashFiles('OTP_VERSION') }} | ||
|
||
- name: Docker login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ inputs.github_token }} | ||
|
||
- name: Build BASE image | ||
shell: bash | ||
run: .github/scripts/build-base-image.sh "${{ inputs.BASE_BRANCH }}" "${{ inputs.TYPE }}" | ||
|
||
- name: Cache pre-built tar archives | ||
if: inputs.BUILD_IMAGE == 'true' | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
otp_src.tar.gz | ||
otp_cache.tar.gz | ||
key: prebuilt-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }} | ||
restore-keys: | | ||
prebuilt-${{ github.ref_name }}-${{ github.sha }} | ||
- name: Build image | ||
if: inputs.BUILD_IMAGE == 'true' | ||
shell: bash -euxo pipefail {0} | ||
run: | | ||
.github/scripts/restore-from-prebuilt.sh `pwd` .github/otp.tar.gz | ||
rm -f otp_{src,cache}.tar.gz | ||
docker build --tag otp \ | ||
--build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \ | ||
--file ".github/dockerfiles/Dockerfile.64-bit" \ | ||
.github/ |
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
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