Initial commit #1
This file contains hidden or 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: API Tests | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to run tests against' | |
| required: true | |
| default: 'docker' | |
| type: choice | |
| options: | |
| - local | |
| - docker | |
| test_folder: | |
| description: 'Test folder to run (leave empty for all)' | |
| required: false | |
| type: string | |
| jobs: | |
| api-tests: | |
| name: Run API Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Compose | |
| run: | | |
| docker compose --version | |
| - name: Start services with Docker Compose | |
| run: | | |
| docker compose up -d | |
| # Wait for services to be ready | |
| echo "Waiting for services to be ready..." | |
| sleep 120 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: tests/postman/package-lock.json | |
| - name: Install Newman and dependencies | |
| working-directory: tests/postman | |
| run: npm install | |
| - name: Run API tests | |
| working-directory: tests/postman | |
| run: | | |
| docker compose up -d | |
| # Wait for services to be ready | |
| echo "Waiting for services to be ready..." | |
| sleep 15 | |
| # Build the Docker image | |
| docker build -t cinemaabyss-api-tests . | |
| # Run the tests in Docker | |
| docker run --network=cinemaabyss-network -v "$(pwd)/reports:/app/reports" cinemaabyss-api-tests | |
| - name: Stop services | |
| if: always() | |
| run: docker compose down |