Merge pull request #76 from Solar-Gators/Hqllow/master #346
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 | |
on: [push] | |
jobs: | |
base-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/solar-gators/base-image:latest | |
cache-from: | | |
type=registry,ref=ghcr.io/solar-gators/base-image:latest | |
build-args: BUILDKIT_INLINE_CACHE=1 | |
client-build: | |
runs-on: ubuntu-latest | |
needs: base-build | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./client/Dockerfile | |
push: true | |
tags: ghcr.io/solar-gators/pit-gui-ui:latest | |
cache-from: | | |
type=registry,ref=ghcr.io/solar-gators/pit-gui-ui:latest | |
build-args: | | |
BUILDKIT_INLINE_CACHE=1 | |
REACT_APP_TELEMETRY_API=http://localhost:9000 | |
backend-build: | |
runs-on: ubuntu-latest | |
needs: base-build | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./backend/Dockerfile | |
push: true | |
tags: ghcr.io/solar-gators/pit-gui-service:latest | |
cache-from: | | |
ghcr.io/solar-gators/pit-gui-service:latest | |
build-args: BUILDKIT_INLINE_CACHE=1 | |
e2e-test: | |
runs-on: ubuntu-latest | |
needs: | |
- backend-build | |
- client-build | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_DATABASE: 'SolarGators_Telemetry_Dev' | |
MYSQL_USER: 'solargators' | |
MYSQL_PASSWORD: 'password' | |
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | |
ports: | |
- 3306:3306 | |
api: | |
image: ghcr.io/solar-gators/pit-gui-service:latest | |
ports: | |
- 9000:9000 | |
env: | |
DATABASE_PASSWORD: 'password' | |
DATABASE_HOST: 'mysql' | |
ui: | |
image: ghcr.io/solar-gators/pit-gui-ui:latest | |
ports: | |
- 3000:80 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cypress run | |
uses: cypress-io/github-action@v5 | |
env: | |
SERVICE_CONTAINER: ${{ job.services.api.id }} | |
- name: Integration Tests | |
run: npm ci && cd backend && npm ci && npm run build && npm test | |
env: | |
REACT_APP_TELEMETRY_API: http://localhost:9000 | |
DATABASE_PASSWORD: 'password' | |
DATABASE_HOST: 'localhost' | |
- run: docker logs "${{ job.services.api.id }}" | |
if: always() |