|
1 | 1 | --- |
2 | 2 | version: 2.1 |
3 | 3 | orbs: |
| 4 | + node: circleci/node@3.0.1 |
4 | 5 | aws-ecr: circleci/aws-ecr@6.5.0 |
5 | 6 | aws-eks: circleci/aws-eks@0.2.3 |
6 | 7 | aws-s3: circleci/aws-s3@1.0.11 |
|
12 | 13 | variables: |
13 | 14 | - &workspace /home/circleci/project |
14 | 15 |
|
15 | | - - &build-image cimg/go:1.13 |
| 16 | + - &build-image cimg/node:14.10 |
16 | 17 |
|
17 | 18 |
|
18 | 19 | aliases: |
@@ -111,30 +112,30 @@ jobs: |
111 | 112 | steps: # steps that comprise the `build` job |
112 | 113 | - attach_workspace: |
113 | 114 | at: *workspace |
114 | | - - restore_cache: # restores saved cache if no changes are detected since last run |
115 | | - keys: |
116 | | - - v1-pkg-cache-{{ checksum "go.sum" }} |
117 | | - - v1-pkg-cache- |
| 115 | + - node/install-packages: |
| 116 | + cache-path: "./node_modules" |
| 117 | + app-dir: . |
118 | 118 | - run: |
119 | | - name: Run unit tests |
120 | | - command: | |
121 | | - go get -u github.com/jstemmer/go-junit-report |
122 | | - mkdir -p test-reports |
123 | | - go test -v ./... | go-junit-report > test-reports/junit.xml |
124 | | -
|
125 | | - - save_cache: # Store cache in the /go/pkg directory |
126 | | - key: v1-pkg-cache-{{ checksum "go.sum" }} |
127 | | - paths: |
128 | | - - "/go/pkg" |
129 | | - |
| 119 | + name: Generating env file |
| 120 | + command: cp .env.example .env |
130 | 121 | - store_test_results: |
131 | 122 | path: test-reports |
132 | | - |
133 | 123 | - store_artifacts: |
134 | 124 | path: test-reports |
135 | 125 |
|
136 | 126 | # Requires the SLACK_WEBHOOK env var to be set |
137 | 127 | #- slack/notify-on-failure |
| 128 | + lint: |
| 129 | + docker: |
| 130 | + - image: *build-image |
| 131 | + working_directory: *workspace |
| 132 | + steps: |
| 133 | + - attach_workspace: |
| 134 | + at: *workspace |
| 135 | + - node/install-packages: |
| 136 | + cache-path: "./node_modules" |
| 137 | + app-dir: . |
| 138 | + - run: npm run lint |
138 | 139 |
|
139 | 140 | build_and_push: |
140 | 141 | machine: |
@@ -243,10 +244,14 @@ workflows: |
243 | 244 | jobs: |
244 | 245 | - checkout_code |
245 | 246 |
|
246 | | - - unit_test: |
| 247 | + - lint: |
247 | 248 | requires: |
248 | 249 | - checkout_code |
249 | 250 |
|
| 251 | + - unit_test: |
| 252 | + requires: |
| 253 | + - lint |
| 254 | + |
250 | 255 | - build_and_push: |
251 | 256 | account-id: "<% index .Params `accountId` %>" |
252 | 257 | repo: "<% .Name %>" |
|
0 commit comments