Skip to content

Commit

Permalink
Allow custom options on container test run (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwi authored Jun 1, 2024
1 parent 22c2fb5 commit e0781e7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/actions/docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ inputs:
default: 'true'
description: 'Whenever the container should be tested on pr.'
required: false
CONTAINER_TEST_RUN_OPTIONS:
default: ''
description: 'Custom options for the docker run command that executes the test'
required: false
CONTAINER_TEST_COMMAND:
default: ''
description: 'A custom command to test the docker container.'
Expand Down Expand Up @@ -145,7 +149,7 @@ runs:
run: |
docker images
echo "Starting container for image: ${{ steps.meta.outputs.tags }}"
docker run -d --rm --name test ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
docker run -d --rm --name test ${{ inputs.CONTAINER_TEST_RUN_OPTIONS }} ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
sleep 20
docker ps
docker logs test
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ on:
type: boolean
default: true
description: 'Whenever the container should be tested on pr.'
CONTAINER_TEST_RUN_OPTIONS:
type: string
default: ''
description: 'Custom options for the docker run command that executes the test'
CONTAINER_TEST_COMMAND:
type: string
default: ''
Expand Down Expand Up @@ -225,7 +229,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: signalwire/actions-template
ref: main
ref: main
path: actions

- uses: ./actions/.github/actions/gpg
Expand Down Expand Up @@ -273,6 +277,7 @@ jobs:
IMAGE_REPO: ${{ inputs.IMAGE_REPO }}
BUILD_ARGS: ${{ inputs.BUILD_ARGS }}
CONTAINER_TEST: ${{ inputs.CONTAINER_TEST }}
CONTAINER_TEST_RUN_OPTIONS: ${{ inputs.CONTAINER_TEST_RUN_OPTIONS }}
CONTAINER_TEST_COMMAND: ${{ inputs.CONTAINER_TEST_COMMAND }}
OUTPUT_TAG_INDEX: ${{ inputs.OUTPUT_TAG_INDEX }}
CACHE_FROM: ${{ inputs.CACHE_FROM }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ on:
type: boolean
default: true
description: 'Whenever the container should be tested on pr.'
CONTAINER_TEST_RUN_OPTIONS:
type: string
default: ''
description: 'Custom options for the docker run command that executes the test'
CONTAINER_TEST_COMMAND:
type: string
default: ''
Expand Down Expand Up @@ -255,6 +259,7 @@ jobs:
PLATFORMS: ${{ inputs.PLATFORMS }}
CONTAINER_SCAN: ${{ inputs.CONTAINER_SCAN }}
CONTAINER_TEST: ${{ inputs.CONTAINER_TEST }}
CONTAINER_TEST_RUN_OPTIONS: ${{ inputs.CONTAINER_TEST_RUN_OPTIONS }}
CONTAINER_TEST_COMMAND: ${{ inputs.CONTAINER_TEST_COMMAND }}
RUNNER: ${{ inputs.RUNNER }}
TAG: ${{ inputs.TAG }}
Expand Down

0 comments on commit e0781e7

Please sign in to comment.