try to limit concurrency only on ARM64 #31
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
on: | ||
workflow_call: | ||
inputs: | ||
is_tag: | ||
description: 'Is a Git Tag' | ||
type: string | ||
required: true | ||
current_branch_tag: | ||
description: 'Git branch or Tag' | ||
type: string | ||
required: true | ||
runner: | ||
description: 'Runner' | ||
type: string | ||
required: true | ||
runner_type: | ||
description: 'Runner type' | ||
type: string | ||
required: true | ||
platform: | ||
description: 'platform' | ||
type: string | ||
required: true | ||
stable_unstable: | ||
description: 'stable_unstable type' | ||
type: string | ||
required: true | ||
secrets: | ||
docker_hub_username: | ||
required: true | ||
docker_hub_token: | ||
required: true | ||
aws_access_key_id: | ||
required: true | ||
aws_secret_access_key: | ||
required: true | ||
jobs: | ||
build-docker: | ||
name: build-docker-${{ inputs.platform }} ${{ inputs.stable_unstable}} | ||
runs-on: ${{ inputs.runner }} | ||
# prevent 2 concurrent jobs (needed for ARM64 self-hosted runner) | ||
concurrency: | ||
group: ${{ | ||
# Only limit concurrency on arm64 build, otherwise, use a random group name | ||
contains(inputs.runner, 'arm64') && 'arm64-group' || github.run_id | ||
}} | ||
cancel-in-progress: false | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }} | ||
steps: | ||
# - name: Maximize build space | ||
# uses: easimon/maximize-build-space@v10 | ||
# with: | ||
# # reserve space for docker | ||
# root-reserve-mb: 38000 | ||
# swap-size-mb: 1024 | ||
# remove-dotnet: 'true' | ||
# remove-android: 'true' | ||
# remove-haskell: 'true' | ||
# remove-codeql: 'true' | ||
# remove-docker-images: 'true' | ||
- name: Maximize build space (2) | ||
# to list folder sizes: | ||
# du -k -d1 * | sort -nr | cut -f2 | xargs -d '\n' du -sh | less | ||
if: inputs.runner_type == 'github-hosted' | ||
run: | | ||
df -h | ||
rm -rf /opt/microsoft && rm -rf /opt/google && rm -rf /opt/az | ||
rm -rf /usr/share/swift && rm -rf /usr/share/miniconda && rm -rf /usr/share/az_* && rm -rf /usr/share/gradle-* && rm -rf /usr/share/sbt | ||
sudo rm -rf /etc/skel | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo docker image prune --all --force | ||
df -h | ||
- uses: actions/checkout@v3 | ||
# - name: Set up QEMU | ||
# if: ${{ inputs.platform == 'linux/arm64' }} | ||
# uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
if: inputs.runner_type == 'github-hosted' | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
config: .github/buildkitd.toml | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.docker_hub_username }} | ||
password: ${{ secrets.docker_hub_token }} | ||
# - name: Setup tmate session | ||
# uses: mxschmitt/action-tmate@v3 | ||
# with: | ||
# limit-access-to-actor: true | ||
# timeout-minutes: 30 | ||
- name: Build normal image with local-build.sh | ||
run: ./local-build.sh version=${{ inputs.stable_unstable }} platform=${{ inputs.platform }} image=normal type=ci step=build currentTag=${{ inputs.current_branch_tag }}-normal-${{ inputs.stable_unstable }} | ||
- name: Install Integration tests prerequisites | ||
run: sudo apt-get install -y dcmtk | ||
- name: Run normal image integration tests | ||
# TODO: enable on ARM64 too | ||
if: inputs.runner_type == 'github-hosted' | ||
run: ./run-integration-tests.sh version=${{ inputs.stable_unstable }} image=normal tagToTest=${{ inputs.current_branch_tag }}-normal-${{ inputs.stable_unstable }} | ||
working-directory: ${{github.workspace}}/docker/integration-tests | ||
- name: Build full image with local-build.sh | ||
run: ./local-build.sh version=${{ inputs.stable_unstable }} platform=${{ inputs.platform }} image=full type=ci step=build currentTag=${{ inputs.current_branch_tag }}-full-${{ inputs.stable_unstable }} | ||
- name: Run full image integration tests | ||
# TODO: enable on ARM64 too | ||
if: inputs.runner_type == 'github-hosted' | ||
run: ./run-integration-tests.sh version=${{ inputs.stable_unstable }} image=full tagToTest=${{ inputs.current_branch_tag }}-full-${{ inputs.stable_unstable }} | ||
working-directory: ${{github.workspace}}/docker/integration-tests | ||
# - name: Setup tmate session | ||
# uses: mxschmitt/action-tmate@v3 | ||
# with: | ||
# limit-access-to-actor: true | ||
# timeout-minutes: 30 | ||
- name: Push normal image with branch/tag | ||
run: ./local-build.sh version=${{ inputs.stable_unstable }} platform=${{ inputs.platform }} image=normal type=ci step=push currentTag=${{ inputs.current_branch_tag }}-normal-${{ inputs.stable_unstable }} pushTag=${{ inputs.current_branch_tag }} isTag=${{ inputs.is_tag }} | ||
- name: Push full image with branch/tag | ||
run: ./local-build.sh version=${{ inputs.stable_unstable }} platform=${{ inputs.platform }} image=full type=ci step=push currentTag=${{ inputs.current_branch_tag }}-full-${{ inputs.stable_unstable }} pushTag=${{ inputs.current_branch_tag }}-full isTag=${{ inputs.is_tag }} | ||
- name: Push normal image with latest tag | ||
if: inputs.is_tag == 'true' | ||
run: ./local-build.sh version=${{ inputs.stable_unstable }} platform=${{ inputs.platform }} image=normal type=ci step=push currentTag=${{ inputs.current_branch_tag }}-normal-${{ inputs.stable_unstable }} pushTag=latest isTag=${{ inputs.is_tag }} | ||
- name: Push full image with latest tag | ||
if: inputs.is_tag == 'true' | ||
run: ./local-build.sh version=${{ inputs.stable_unstable }} platform=${{ inputs.platform }} image=full type=ci step=push currentTag=${{ inputs.current_branch_tag }}-full-${{ inputs.stable_unstable }} pushTag=latest-full isTag=${{ inputs.is_tag }} | ||
- name: Setup tmate session | ||
if: ${{ failure() && inputs.runner_type == 'github-hosted' }} | ||
uses: mxschmitt/action-tmate@v3 | ||
with: | ||
limit-access-to-actor: true | ||
timeout-minutes: 20 |