Repository navigation
118 lines (106 loc) · 3.94 KB
/
Copy pathmain.yml
File metadata and controls
118 lines (106 loc) · 3.94 KB
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
# This Workflow Builds, Tests, Lints, and Deploys the UI and API to Heroku
name: CICD for Main branch
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# 'jobs' is the list of all the workflows that will kick off.
jobs:
# This workflow kicks off the build and test for the UI
build-and-test-client:
# Name of the build job
name: Build and Test Client
# The type of runner that the job will run on
runs-on: ubuntu-latest
# `steps` are the actions that will execute on this job.
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell to build the UI
- name: Build Client
run: |
docker build -t smartsheets-client ./client
# Runs a set of commands using the runners shell to test the UI
- name: Test Client
run: |
docker run -e CI=true smartsheets-client npm run test
# This workflow kicks off the build and test for the API
build-and-test-server:
name: Build and Test Server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Server
run: |
docker build -t smartsheets-server ./server
- name: Test Server
run: |
docker run -e CI=true smartsheets-server npm run test
# This workflow kicks off the deployment to Heroku for the UI
deploy-client:
name: Deploy Client to Heroku
# Needs specifies the steps that must previously complete in order to deploy your application.
needs: [ build-and-test-client, build-and-test-server ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: akhileshns/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "smartsheets-client"
heroku_email: "lfry94@gmail.com"
appdir: "client/"
usedocker: true
# This workflow kicks off the deployment to Heroku for the UI
deploy-server:
name: Deploy Server to Heroku
needs: [ build-and-test-client, build-and-test-server ]
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: akhileshns/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "smartsheets-server"
heroku_email: "lfry94@gmail.com"
appdir: "server/"
usedocker: true
# This workflow kicks off the linter for your API.
run-server-linter:
name: Lint Server Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files
fetch-depth: 0
# Installs dependencies on the runner for API
- name: Install linter options
run: npm --prefix ./server install
# Executes the linter on the API code base.
- name: Run Linter
run: npm --prefix ./server run lint
# This workflow kicks off the linter for API.
run-client-linter:
name: Lint Client Code Base
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
# Installs dependencies on the runner for UI
- name: Install linter options
run: npm --prefix ./client install
# Executes the linter on the UI code base.
- name: Run Linter
run: npm --prefix ./client run lint