cockpit/.github/workflows/unit-tests.yml

44 lines
1.5 KiB
YAML

name: unit-tests
on: [pull_request, workflow_dispatch]
jobs:
unit-tests:
runs-on: ubuntu-22.04
strategy:
matrix:
startarg:
- { make: 'check-memory', cc: 'clang', tag: 'i386' }
- { make: 'check-memory', cc: 'gcc', tag: 'latest' }
- { make: 'distcheck', cc: 'clang', tag: 'latest' }
- { make: 'distcheck', cc: 'gcc', tag: 'i386' }
- { make: 'pycheck', cc: 'gcc', tag: 'latest', network: '--network' }
- { make: 'check', cc: 'gcc', tag: 'latest' }
fail-fast: false
timeout-minutes: 60
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
# need this to also fetch tags
fetch-depth: 0
- name: Build unit test container if it changed
run: |
changes=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}..HEAD -- containers/unit-tests/)
if [ -n "${changes}" ]; then
case '${{ matrix.startarg.tag }}' in
i386) arch=i386;;
latest) arch=amd64;;
esac
containers/unit-tests/build $arch
fi
- name: Run unit-tests container
timeout-minutes: 30
run: |
containers/unit-tests/start \
--verbose \
${{ matrix.startarg.network }} \
--env=CC='${{ matrix.startarg.cc }}' \
--image-tag='${{ matrix.startarg.tag }}' \
--make '${{ matrix.startarg.make }}'