-
Notifications
You must be signed in to change notification settings - Fork 3
119 lines (106 loc) · 3.15 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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()