Skip to content

Commit 749d300

Browse files
author
Tim De Pauw
committed
Use Node v14.17.0 & Yarn v1.22.10; improve CI config
1 parent bdf9e8b commit 749d300

File tree

4 files changed

+37
-41
lines changed

4 files changed

+37
-41
lines changed

.circleci/config.yml

+34-38
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,66 @@
1-
# JavaScript Node CircleCI 2.0 configuration file
2-
#
3-
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
4-
#
51
version: 2
62
jobs:
73
build:
84
docker:
9-
- image: circleci/node:14-browsers
10-
11-
working_directory: ~/repo
12-
5+
- image: cimg/node:14.17.0
136
environment:
147
AWS_PAGER: ''
15-
168
steps:
179
- checkout
18-
19-
# Download and cache dependencies
20-
- restore_cache:
21-
keys:
22-
- node14-dependencies-v2-{{ checksum "yarn.lock" }}
23-
# Fallback to using the latest cache if no exact match is found
24-
- node14-dependencies-v2-
25-
2610
- run:
27-
name: Set up apt
11+
name: Install AWS CLI v2
2812
command: |
29-
sudo apt-get -qq update
30-
sudo apt-get -y -qq install apt-transport-https
31-
13+
curl -sSL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip
14+
unzip awscliv2.zip
15+
rm awscliv2.zip
16+
sudo aws/install
17+
- restore_cache:
18+
keys:
19+
- node14-dependencies-v2-{{ checksum "yarn.lock" }}
20+
- node14-dependencies-v2-
3221
- run:
3322
name: Install Yarn
3423
command: |
24+
# Remove preinstalled Yarn to avoid conflicts
3525
sudo rm -f /usr/local/bin/yarn
36-
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
37-
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
38-
sudo apt-get -qq update
39-
# transform the '>=x.y.z' version constraint in package.json to the 'x.y.z-1' version format of apt-get
40-
YARN_VERSION=$( jq -r '(.engines.yarn | gsub("[^0-9.]";"")) + "-1"' < package.json )
41-
sudo apt-get -qq install --no-install-recommends yarn=$YARN_VERSION
42-
26+
# Get Yarn version from package.json and remove >= prefix
27+
YARN_VERSION=$( jq -r '(.engines.yarn | gsub("[^0-9.]";""))' < package.json )
28+
# Download and install
29+
curl -sSL "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn_${YARN_VERSION}_all.deb" -o yarn.deb
30+
sudo dpkg -i yarn.deb
31+
rm yarn.deb
4332
- run:
4433
name: Install dependencies
4534
command: yarn --frozen-lockfile
46-
4735
- save_cache:
4836
paths:
4937
- ~/.cache/yarn
5038
- node_modules
5139
key: node14-dependencies-v2-{{ checksum "yarn.lock" }}
52-
53-
# Build
5440
- run:
5541
name: Build
5642
command: |
5743
export REACT_APP_VERSION=${CIRCLE_SHA1:0:7}
5844
export REACT_APP_BRANCH=$CIRCLE_BRANCH
5945
export REACT_APP_BUILD_DATE=$(TZ=GMT date +'%b %_d, %Y, %_I:%M %p %Z')
60-
yarn build
61-
62-
# Run tests
46+
yarn run build
6347
- run:
6448
name: Test
65-
command: yarn test
66-
49+
command: yarn run test
6750
- deploy:
51+
name: Deploy if allowed
6852
command: |
69-
sudo apt-get -y -qq install awscli
70-
aws s3 sync build/ s3://vasttester-origin-$CIRCLE_BRANCH.iabtechlab.com/ --delete --cache-control max-age=300 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
53+
BRANCHES='master candidate release'
54+
if [[ " $BRANCHES " = *" $CIRCLE_BRANCH "* ]]; then
55+
BUCKET=vasttester-origin-$CIRCLE_BRANCH.iabtechlab.com
56+
echo Installing
57+
echo Deploying to $BUCKET...
58+
aws s3 sync \
59+
build/ \
60+
s3://$BUCKET/ \
61+
--delete \
62+
--cache-control max-age=300 \
63+
--grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
64+
else
65+
echo Not deploying $CIRCLE_BRANCH branch
66+
fi

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.16.1
1+
14.17.0

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.16.1
1+
14.17.0

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"license": "Apache-2.0",
99
"engines": {
1010
"node": ">=12",
11-
"yarn": ">=1.22.5"
11+
"yarn": ">=1.22.10"
1212
},
1313
"browserslist": [
1414
">0.2%",

0 commit comments

Comments
 (0)