Frontend CI #1
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: Frontend Continuous Integration | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
Linting: | |
runs-on: ubuntu-latest | |
environment: Devlopmnet Environment | |
steps: | |
- name: Check the Repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: starter/frontend/package-lock.json | |
- name: Install Dependencies | |
working-directory: starter/frontend | |
run: npm ci | |
- name: Checkout Run Lint | |
run: cd starter/frontend && npm run lint | |
Test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check the Repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: starter/frontend/package-lock.json | |
- name: Install Dependencies | |
working-directory: starter/frontend | |
run: npm ci | |
- name: Test | |
run: cd starter/frontend && npm run test | |
Build: | |
needs: [Linting, Test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check the Repository | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: starter/frontend/package-lock.json | |
- name: Build and Run Docker Image | |
run: | | |
cd starter/frontend | |
docker build --build-arg=REACT_APP_MOVIE_API_URL=http://localhost:5000 --tag=mp-frontend:latest . | |
docker run --name mp-frontend -p 3000:3000 -d mp-frontend |