Skip to content

Commit

Permalink
[CI] add golang tests launch
Browse files Browse the repository at this point in the history
Signed-off-by: v.oleynikov <[email protected]>
  • Loading branch information
duckhawk committed Aug 2, 2024
1 parent 1f469d0 commit 34a1a46
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/go_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Go tests for images

on:
pull_request:
push:
branches:
- main

jobs:
test:
name: Go tests for images
runs-on: [self-hosted, regular]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Run Go tests
run: |
basedir=$(pwd)
failed='false'
for dir in $(find images -type d); do
if ls $dir/*_test.go &> /dev/null; then
echo "Running tests in $dir"
cd $dir
go test -v
if [ $? -ne 0 ]; then
echo "Tests failed in $dir"
failed='true'
fi
cd $basedir
fi
done
if [ $failed == 'true' ]; then
exit 1
fi

0 comments on commit 34a1a46

Please sign in to comment.