Skip to content

Commit

Permalink
Merge pull request #58 from crazy-max/container-logs-check
Browse files Browse the repository at this point in the history
test: use composite container-logs-check action
  • Loading branch information
crazy-max authored May 17, 2023
2 parents 58b672e + 2df4992 commit a2b7d3e
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ on:
env:
BUILD_TAG: test
CONTAINER_NAME: samba
RUNNING_TIMEOUT: 120
RUNNING_LOG_CHECK: " started."

jobs:
test:
Expand Down Expand Up @@ -49,27 +47,12 @@ jobs:
-v "/tmp/baz_password:/tmp/baz_password:ro" \
${{ env.BUILD_TAG }}
-
name: Test run
run: |
TIMEOUT=$((SECONDS + ${{ env.RUNNING_TIMEOUT }}))
while read LOGLINE; do
echo ${LOGLINE}
if [[ ${LOGLINE} == *"${{ env.RUNNING_LOG_CHECK }}"* ]]; then
echo "🎉 Container up!"
break
fi
if [[ $SECONDS -gt ${TIMEOUT} ]]; then
>&2 echo "❌ Failed to run ${{ env.CONTAINER_NAME }} container"
exit 1
fi
done < <(docker logs -f ${{ env.CONTAINER_NAME }} 2>&1)
CONTAINER_STATUS=$(docker container inspect --format "{{.State.Status}}" ${{ env.CONTAINER_NAME }})
if [[ ${CONTAINER_STATUS} != "running" ]]; then
>&2 echo "❌ Container ${{ env.CONTAINER_NAME }} returned status '$CONTAINER_STATUS'"
exit 1
fi
echo
name: Check container logs
uses: crazy-max/.github/.github/actions/container-logs-check@main
with:
container_name: ${{ env.CONTAINER_NAME }}
log_check: " started."
timeout: 20
-
name: Dump smb.conf
run: |
Expand Down

0 comments on commit a2b7d3e

Please sign in to comment.