Configure tests #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
validate: | |
name: validate | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: | | |
{ | |
"dir": ${{ steps.set-matrix.outputs.dirs }} | |
} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Validate | |
uses: pre-commit/[email protected] | |
- name: Configure matrix for test | |
id: set-matrix | |
run: | | |
DIRS=$(find . -type f -name 'docker-compose.yml' -exec dirname "{}" \; | sort -u | jq -R | jq -s -c) | |
echo "dirs=${DIRS}" >> "$GITHUB_OUTPUT" | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
needs: validate | |
strategy: | |
matrix: ${{ fromJson(needs.validate.outputs.matrix) }} | |
fail-fast: false | |
max-parallel: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Run containers | |
timeout-minutes: 10 | |
working-directory: ${{ matrix.dir }} | |
run: | | |
docker compose -f up -d --wait | |
- name: Stop containers | |
if: always() | |
working-directory: ${{ matrix.dir }} | |
run: | | |
docker compose down -v |