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: Test Pipeline with Docker Compose and Cypress | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Dependencies | |
run: npm install | |
- name: Set up Docker | |
uses: docker/setup-qemu-action@v2 | |
- name: Start MongoDB Database using Docker Compose | |
run: docker-compose up -d | |
- name: Wait for MongoDB to Initialize | |
run: | | |
sleep 10 | |
docker ps | |
- name: Import Data into MongoDB | |
run: node cypress/mongodb/import.js | |
- name: Run Cypress Tests | |
uses: cypress-io/github-action@v5 | |
with: | |
record: true | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
MONGO_URI: ${{secrets.MONGO_URI}} | |
MONGO_COLLECTION: ${{secrets.MONGO_COLLECTION}} | |
MONGO_DB: ${{secrets.MONGO_DB}} | |
- name: Stop Docker Compose | |
run: docker-compose down |