k6 ok #29
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: workflow-pipeline | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| jobs: | |
| # --- JOB 1: API TESTS --- | |
| api-tests: | |
| name: API Testing | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| - run: npm ci | |
| - run: npx playwright install --with-deps | |
| - name: Run API Tests | |
| run: npm run test:api | |
| env: | |
| API_BASE_URL: ${{ secrets.API_BASE_URL }} | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: api-report | |
| path: playwright-report/ | |
| # --- JOB 2: E2E TESTS (CUCUMBER) --- | |
| e2e-tests: | |
| name: E2E Testing | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| - run: npm ci | |
| - run: npx playwright install --with-deps | |
| - name: Run E2E Tests | |
| run: npm run test:e2e | |
| env: | |
| SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | |
| SAUCE_PASSWORD: ${{ secrets.SAUCE_PASSWORD }} | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: cucumber-report | |
| path: cucumber-report.html | |
| # --- JOB 3: MOBILE TESTS --- | |
| mobile-tests: | |
| name: Mobile Testing | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| - run: npm ci | |
| - run: npx playwright install --with-deps | |
| - name: Run Mobile Tests | |
| run: npm run test:mobile | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mobile-report | |
| path: playwright-report/ | |
| # --- JOB 4: LOAD TESTS (K6) --- | |
| load-tests: | |
| name: Performance Testing | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| - run: npm ci | |
| - name: Setup K6 | |
| uses: grafana/setup-k6-action@v1 | |
| - name: Start Docker & Run Load Tests | |
| run: | | |
| docker compose -f tests/k6-load/docker-compose.yml up -d influxdb grafana | |
| npm run k6:ci -- --summary-export=k6-summary.json | |
| env: | |
| K6_BASE_URL: "https://httpbin.org" | |
| - name: Stop Docker | |
| if: always() | |
| run: npm run k6:down | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: k6-report | |
| path: k6-summary.json |