Skip to content

Commit

Permalink
Merge manual build workflow into ci
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Nov 25, 2024
1 parent cf728a0 commit ecd12e7
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
55 changes: 54 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
list:
description: 'Comma-separated list of directories in the form: ["dir1", "dir2"]'
required: true
default: ''
jobs:
# Job to run change detection
changes:
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'images' output variable
Expand All @@ -24,7 +31,7 @@ jobs:
# you can specify it directly.
# If it's not configured, the repository default branch is used.
base: ${{ github.ref }}
filters: |
filters: |
aws-cli: 'aws-cli/**'
black: 'black/**'
buildpack-deps/ubuntu/jammy: 'buildpack-deps/ubuntu/jammy/**'
Expand Down Expand Up @@ -121,8 +128,54 @@ jobs:
if: ${{ needs.changes.outputs.images != '' && needs.changes.outputs.images != '[]' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get build parameters
shell: bash
working-directory: ${{ matrix.image }}
run: |
echo "run-lint-stage=$($(git rev-parse --show-toplevel)/bin/run-lint-stage.sh)" >> $GITHUB_ENV
echo "run-test-stage=$($(git rev-parse --show-toplevel)/bin/run-test-stage.sh)" >> $GITHUB_ENV
echo "test-entrypoint=$($(git rev-parse --show-toplevel)/bin/test-entrypoint.sh)" >> $GITHUB_ENV
cat $GITHUB_ENV
- uses: boxcutter/container-build-publish-action@main
with:
workdir: ${{ matrix.image }}
build-type: 'hosted'
run-lint-stage: ${{ env.run-lint-stage }}
run-test-stage: ${{ env.run-test-stage }}
test-entrypoint: ${{ env.test-entrypoint }}
dockerhub-username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}

# Job to build and test each of the modified images
manual-build:
strategy:
matrix:
directory: ${{ fromJSON(github.event.inputs.list) }}
if: ${{ github.event.inputs.list != '' && github.event.inputs.list != '[]' && github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get build parameters
shell: bash
working-directory: ${{ matrix.directory }}
run: |
echo "run-lint-stage=$($(git rev-parse --show-toplevel)/bin/run-lint-stage.sh)" >> $GITHUB_ENV
echo "run-test-stage=$($(git rev-parse --show-toplevel)/bin/run-test-stage.sh)" >> $GITHUB_ENV
echo "test-entrypoint=$($(git rev-parse --show-toplevel)/bin/test-entrypoint.sh)" >> $GITHUB_ENV
cat $GITHUB_ENV
- uses: boxcutter/container-build-publish-action@main
with:
workdir: ${{ matrix.directory }}
build-type: 'hosted'
run-lint-stage: ${{ env.run-lint-stage }}
run-test-stage: ${{ env.run-test-stage }}
test-entrypoint: ${{ env.test-entrypoint }}
dockerhub-username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}
File renamed without changes.
55 changes: 55 additions & 0 deletions .github/workflows/old/nvidia-l4t-ros.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: nvidia-l4t-ros

on:
push:
branches: [ main ]
paths:
- 'nvidia/l4t-ros/**'
pull_request:
branches: [ main ]
paths:
- 'nvidia/l4t-ros/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: nvidia/l4t-ros
steps:
- uses: actions/checkout@v4

- name: Install QEMU static binaries
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}

- name: Build and push
uses: docker/bake-action@v4
with:
workdir: nvidia/l4t-ros
push: ${{ github.event_name != 'pull_request' }}

- name: Get the image description
if: github.event_name != 'pull_request'
id: image_description
run: |
echo "image_description=$(docker buildx bake --print 2> /dev/null | jq -r '.target.nvidia-l4t-ros-35-3-1.labels."org.opencontainers.image.description"')" >> $GITHUB_ENV
- name: Update Docker Hub Description
if: github.event_name != 'pull_request'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }}
repository: boxcutter/nvidia-l4t-ros
short-description: ${{ env.image_description }}
readme-filepath: nvidia/l4t-jetpack/README.md

0 comments on commit ecd12e7

Please sign in to comment.