-
Notifications
You must be signed in to change notification settings - Fork 12
163 lines (137 loc) · 4.65 KB
/
continuous-integration.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Continuous Integration
on:
push:
branches:
- '**'
tags-ignore:
- '**'
env:
CHROMEDRIVER_FILEPATH: /usr/local/share/chrome_driver/chromedriver
concurrency:
group: ${{ github.ref != 'refs/heads/master' && github.ref || github.sha }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
uses: ./.github/workflows/install
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Lint
run: yarn lint
testing:
name: Testing
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
uses: ./.github/workflows/install
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Test
run: yarn test
env:
NODE_ENV: test
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
uses: ./.github/workflows/install
with:
key: ${{ hashFiles('yarn.lock') }}
yarn_cache_folder: .cache/yarn
path: |
.cache/yarn
node_modules
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-gov-west-1
- name: Get va-vsp-bot token
uses: marvinpinto/[email protected]
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Build
run: GITHUB_API_KEY=${{ env.VA_VSP_BOT_GITHUB_TOKEN }} yarn build
- name: Compress documentation build
if: github.ref == 'refs/heads/master'
run: tar -C packages/documentation/public -cvf documentation.tar.bz2 .
- name: Upload documentation build artifact
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v2
with:
name: documentation.tar.bz2
path: documentation.tar.bz2
retention-days: 1
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [linting, build]
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get Node version
id: get-node-version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- name: Setup Node and cache documentation dependencies
uses: actions/setup-node@v2
with:
node-version: ${{ steps.get-node-version.outputs.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: packages/documentation/yarn.lock
- name: Install dependencies
uses: nick-invision/retry@v2
with:
command: cd packages/documentation && yarn install --frozen-lockfile --prefer-offline --production=false
max_attempts: 3
timeout_minutes: 7
env:
YARN_CACHE_FOLDER: ~/.cache/yarn
- name: Download documentation build artifact
uses: actions/download-artifact@v2
with:
name: documentation.tar.bz2
- name: Extract documentation build artifact
run: |
mkdir packages/documentation/public
tar -C packages/documentation/public -xvf documentation.tar.bz2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-gov-west-1
- name: Get va-vsp-bot token
uses: marvinpinto/[email protected]
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Set username and email
run: |
git config user.email [email protected]
git config user.name va-vsp-bot
- name: Deploy
run: |
git remote set-url origin https://git:${{ env.VA_VSP_BOT_GITHUB_TOKEN }}@github.com/department-of-veterans-affairs/veteran-facing-services-tools.git
yarn deploy
working-directory: packages/documentation