Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom options on container test run #288

Merged
merged 2 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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