Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Koenig <okoenig@nvidia.com>
  • Loading branch information
ko3n1g committed Sep 19, 2024
1 parent 6690326 commit 1c4ffda
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 61 deletions.
51 changes: 0 additions & 51 deletions .github/actions/build-container/action.yml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/_build_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Build NeMo Aligner container
on:
workflow_call:
inputs:
pr_number:
type: number
description: PR number
required: true

defaults:
run:
shell: bash -x -e -u -o pipefail {0}

jobs:
build:
runs-on: self-hosted-builder
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}

- name: Clean runner cache
run: |
docker system prune --filter "until=24h" --force
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# We use `docker` driver as this speeds things up for
# trivial (non-multi-stage) builds.
driver: docker

- name: Pull cache images
run: |
docker pull nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number || 'buildcache' }} || true
docker pull nemoci.azurecr.io/nemo_aligner_container:buildcache || true
- name: Build and push
uses: docker/build-push-action@v5
with:
file: Dockerfile
push: true
build-args: |
MAX_JOBS=32
ALIGNER_COMMIT=${{ github.event.pull_request.head.sha || github.sha }}
cache-from: |
nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number || 'buildcache' }}
nemoci.azurecr.io/nemo_aligner_container:buildcache
cache-to: type=inline
tags: nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }}

- name: Update PR image
if: github.event_name == 'pull_request'
run: |
docker tag nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number }}
docker push nemoci.azurecr.io/nemo_aligner_container:${{ github.event.pull_request.number }}
- name: Update buildcache image
if: github.ref == 'refs/heads/main'
run: |
docker tag nemoci.azurecr.io/nemo_aligner_container:${{ github.run_id }} nemoci.azurecr.io/nemo_aligner_container:buildcache
docker push nemoci.azurecr.io/nemo_aligner_container:buildcache
13 changes: 3 additions & 10 deletions .github/workflows/cicd-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ concurrency:

jobs:
build:
runs-on: self-hosted-builder
if: ${{ github.event.label.name == 'Run CICD' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}

- name: Build container
uses: ./${{ github.run_id }}/.github/actions/build-container
uses: ./.github/workflows/_build_container.yml
with:
pr_number: ${{ github.event.pull_request.number || 'buildcache' }}

0 comments on commit 1c4ffda

Please sign in to comment.