Skip to content

Commit a114f9d

Browse files
authored
chore(ls): add travis configuration (#4)
Enables running CI on travis
1 parent d26eac2 commit a114f9d

File tree

6 files changed

+131
-0
lines changed

6 files changed

+131
-0
lines changed

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: node_js
2+
sudo: false
3+
node_js:
4+
- '6.6.0'
5+
6+
cache:
7+
directories:
8+
- ./node_modules
9+
- ./client/node_modules
10+
- ./server/node_modules
11+
12+
env:
13+
matrix:
14+
# Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete.
15+
- CI_MODE=normal
16+
17+
install:
18+
- ./scripts/ci/install.sh
19+
20+
script:
21+
- ./scripts/ci/build.sh && ./scripts/ci/test.sh
22+
23+
after_script:
24+
- ./scripts/ci/cleanup.sh

scripts/ci/build.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex -o pipefail
4+
5+
echo 'travis_fold:start:BUILD'
6+
7+
# Setup the environment
8+
cd $(dirname $0)
9+
source ./env.sh
10+
cd ../..
11+
12+
# Build the server
13+
echo 'travis_fold:start:build.server'
14+
(
15+
cd server
16+
npm run compile
17+
)
18+
echo 'travis_fold:end:build.server'
19+
20+
# Build the client
21+
echo 'travis_fold:start:build.client'
22+
(
23+
cd client
24+
$(npm bin)/tsc
25+
)
26+
echo 'travis_fold:end:build.client'
27+
28+
# Install server production dependencies
29+
echo 'travis_fold:start:build.server.deps'
30+
(
31+
cd client/server
32+
npm install --prod
33+
)
34+
echo 'travis_fold:end:build.server.deps'
35+
36+
# Build the .vsix file
37+
echo 'travis_fold:start:build.vsix'
38+
(
39+
mkdir dist
40+
cd client
41+
vsce package --out ../dist/ngls-${SHA}
42+
)
43+
echo 'travis_fold:end:build.vsix'
44+
45+
echo 'travis_fold:end:BUILD'

scripts/ci/cleanup.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex -o pipefail
4+
5+
echo 'travis_fold:start:CLEANUP'
6+
7+
# Nothing to clean up
8+
9+
echo 'travis_fold:end:CLEANUP'

scripts/ci/env.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e -o pipefail
4+
5+
NPM_VERSION=3.5.3
6+
SHA=$(git log --oneline -1 | awk '{print $1}')

scripts/ci/install.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex -o pipefail
4+
5+
echo 'travis_fold:start:INSTALL'
6+
7+
# Setup the environment
8+
cd $(dirname $0)
9+
source ./env.sh
10+
cd ../..
11+
12+
# Install npm version we need
13+
echo 'travis_fold:start:install.npm'
14+
npm install -g npm@${NPM_VERSION}
15+
echo 'travis_fold:end.install.npm'
16+
17+
# Install vsce
18+
echo 'travis_fold:start:install.vsce'
19+
npm install -g vsce
20+
echo 'travis_fold:end:install.vsce'
21+
22+
# Install all npm server dependencies
23+
echo 'travis_fold:start:install.server.node_modules'
24+
(
25+
cd server
26+
npm install
27+
)
28+
echo 'travis_fold:end:install.server.node_modules'
29+
30+
# Install all npm client dependencies
31+
echo 'travis_fold:start:install.client.node_modules'
32+
(
33+
cd client
34+
npm install
35+
)
36+
echo 'travis_fold:end:install.client.node_modules'
37+
38+
echo 'travis_fold:end:INSTALL'

scripts/ci/test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex -o pipefail
4+
5+
echo 'travis_fold:start:TEST'
6+
7+
# Add tests here
8+
9+
echo 'travis_fold:end:TEST'

0 commit comments

Comments
 (0)