Skip to content

Commit b609daf

Browse files
committed
Annotate semaphore.yml
1 parent fa86d59 commit b609daf

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

.semaphore/semaphore.yml

+44-1
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,67 @@
1+
# Use the latest stable version of Semaphore 2.0 YML syntax:
12
version: v1.0
3+
4+
# Name your pipeline. In case you connect multiple pipelines with promotions,
5+
# the name will help you differentiate between, for example, a CI build phase
6+
# and delivery phases.
27
name: Semaphore JavaScript Example Pipeline
8+
9+
# An agent defines the environment in which your code runs.
10+
# It is a combination of one of available machine types and operating
11+
# system images.
12+
# See https://docs.semaphoreci.com/article/20-machine-types
13+
# and https://docs.semaphoreci.com/article/32-ubuntu-1804-image
314
agent:
415
machine:
516
type: e1-standard-2
617
os_image: ubuntu1804
718

19+
# Blocks are the heart of a pipeline and are executed sequentially.
20+
# Each block has a task that defines one or more jobs. Jobs define the
21+
# commands to execute.
22+
# See https://docs.semaphoreci.com/article/62-concepts
823
blocks:
924
- name: Install dependencies
1025
task:
26+
# Set environment variables that your project requires.
27+
# See https://docs.semaphoreci.com/article/66-environment-variables-and-secrets
1128
env_vars:
1229
- name: NODE_ENV
1330
value: test
1431
- name: CI
1532
value: 'true'
33+
34+
# This block runs two jobs in parallel and they both share common
35+
# setup steps. We can group them in a prologue.
36+
# See https://docs.semaphoreci.com/article/50-pipeline-yaml#prologue
1637
prologue:
1738
commands:
39+
# Get the latest version of our source code from GitHub:
1840
- checkout
41+
42+
# Use the version of Node.js specified in .nvmrc.
43+
# Semaphore provides nvm preinstalled.
1944
- nvm use
2045
- node --version
2146
- npm --version
2247
jobs:
48+
# First parallel job:
2349
- name: client npm install and cache
2450
commands:
2551
- cd src/client
52+
53+
# Restore dependencies from cache. This command will not fail in
54+
# case of a cache miss. In case of a cache hit, npm install will
55+
# run very fast.
56+
# For more info on caching, see https://docs.semaphoreci.com/article/68-caching-dependencies
2657
- cache restore client-node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json),client-node-modules-$SEMAPHORE_GIT_BRANCH,client-node-modules-master
2758
- npm install
59+
60+
# Store the latest version of node modules in cache to reuse in
61+
# further blocks:
2862
- cache store client-node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json) node_modules
63+
64+
# Second parallel job:
2965
- name: server npm install and cache
3066
commands:
3167
- cd src/server
@@ -50,7 +86,10 @@ blocks:
5086
- name: Client Lint
5187
commands:
5288
- cd src/client
89+
# At this point we can assume 100% cache hit rate of node modules:
5390
- cache restore client-node-modules-$SEMAPHORE_GIT_BRANCH-$(checksum package-lock.json),client-node-modules-$SEMAPHORE_GIT_BRANCH,client-node-modules-master
91+
92+
# Run task as defined in package.json:
5493
- npm run lint
5594
- name: Server Lint
5695
commands:
@@ -96,10 +135,14 @@ blocks:
96135
- nvm use
97136
- node --version
98137
- npm --version
138+
# Start a Postgres database. On Semaphore, databases run in the same
139+
# environment as your code.
140+
# See https://docs.semaphoreci.com/article/32-ubuntu-1804-image#databases-and-services
99141
- sem-service start postgres
142+
# With unrestricted sudo access, you can install any additional
143+
# system package:
100144
- sudo apt-get install -y libgtk2.0-0
101145
jobs:
102-
# TODO cypress require additional package to be installed on ci server
103146
- name: Client Tests
104147
commands:
105148
- cd src/client

0 commit comments

Comments
 (0)