Skip to content

Merge pull request #1165 from RBC/e2e-testing #1

Merge pull request #1165 from RBC/e2e-testing

Merge pull request #1165 from RBC/e2e-testing #1

Workflow file for this run

name: E2E Tests
permissions:
contents: read
issues: write
pull-requests: write
on:
push:
branches: [main]
issue_comment:
types: [created]
jobs:
e2e:
runs-on: ubuntu-latest
# Run on push/PR or when a maintainer comments "/test e2e" or "/run e2e"
if: |
github.event_name != 'issue_comment' || (
github.event.issue.pull_request &&
(contains(github.event.comment.body, '/test e2e') || contains(github.event.comment.body, '/run e2e')) &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR')
)
steps:
- name: Checkout code
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
with:
# When triggered by comment, checkout the PR branch
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
- name: Set up Docker Compose
uses: docker/setup-compose-action@364cc21a5de5b1ee4a7f5f9d3fa374ce0ccde746
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Configure Git for CI
run: |
git config --global user.name "CI Runner"
git config --global user.email "ci@example.com"
git config --global init.defaultBranch main
- name: Build and start services with Docker Compose
run: docker compose up -d --build
- name: Wait for services to be ready
run: |
timeout 60 bash -c 'until docker compose ps | grep -q "Up"; do sleep 2; done'
sleep 10
- name: Run E2E tests
run: npm run test:e2e
- name: Stop services
if: always()
run: docker compose down -v