name: Docker Build and Test on: push: branches: - main pull_request: branches: - main jobs: test: runs-on: ubuntu-latest steps: # Checkout the repository - name: Checkout repository uses: actions/checkout@v2 # Set up Docker Buildx (optional, for multi-platform support) - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 # Cache Docker layers to speed up builds (optional) - name: Cache Docker layers uses: actions/cache@v2 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- # Build Docker image from the ./tests directory - name: Build Docker image run: | docker build -t test-runner:swarm-testing ./tests # Ensure logs directory exists in the GitHub workspace - name: Ensure logs directory exists run: | mkdir -p ${{ github.workspace }}/logs # Run Docker container with OpenAI API Key securely - name: Run Docker container with OpenAI API Key run: | docker run -e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} -v ${{ github.workspace }}/logs:/usr/src/app/logs test-runner:swarm-testing