Add Unit Testing Validation in the pipeline #21
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: CI Build Docker-Compose Backend App | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build-node-app: | |
runs-on: ubuntu-latest | |
env: | |
APP_PORT: ${{ secrets.APP_PORT }} | |
APP_CORS_ALLOWED_ORIGINS: ${{ secrets.APP_CORS_ALLOWED_ORIGINS }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
TWITCH_CLIENT_ID: ${{ secrets.TWITCH_CLIENT_ID }} | |
TWITCH_SECRET_ID: ${{ secrets.TWITCH_SECRET_ID }} | |
DB_USER: ${{ secrets.DB_USER }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_HOST: ${{ secrets.DB_HOST }} | |
DB_PORT: ${{ secrets.DB_PORT }} | |
DB_NAME: ${{ secrets.DB_NAME }} | |
DB_SCHEMA: ${{ secrets.DB_SCHEMA }} | |
DB_URL: postgresql://${{ secrets.DB_USER}}:${{secrets.DB_PASSWORD}}@${{secrets.DB_HOST}}:${{secrets.DB_PORT}}/${{secrets.DB_NAME}}?schema=${{secrets.DB_SCHEMA}} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install Dependencies | |
run: npm install | |
- name: Run Tests | |
run: npm test | |
- name: Set up Docker Compose | |
run: | | |
docker-compose -f docker-compose.actions.yml up -d | |
- name: Clean Up | |
run: | | |
docker-compose -f docker-compose.actions.yml down | |
docker system prune -f |