-
-
Notifications
You must be signed in to change notification settings - Fork 11
129 lines (119 loc) · 4.01 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
name: Continuous Integration
on:
pull_request:
push:
branches-ignore:
- staging
- master
- main
jobs:
pre_ci:
name: Prepare CI environment
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: '[Push] Get commit message'
if: github.event_name == 'push'
id: push_get_commit_message
run: echo ::set-output name=push_commit_message::$(git log --format=%B -n 1 HEAD)
- name: '[Pull Request] Get commit message'
if: github.event_name == 'pull_request'
id: pr_get_commit_message
run: echo ::set-output name=pr_commit_message::$(git log --format=%B -n 1 HEAD^2)
- name: Add problem matchers
run: |
echo "::add-matcher::.github/problemMatchers/tsc.json"
echo "::add-matcher::.github/problemMatchers/eslint-stylish.json"
outputs:
commit_message: $( [ -z "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" ] && echo "${{ steps.push_get_commit_message.outputs.push_commit_message }}" || echo "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" )
Linting:
name: Linting
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js 15
uses: actions/setup-node@v2
with:
node-version: 15
- name: Restore CI Cache
uses: actions/cache@v2.1.4
with:
path: node_modules
key: ${{ runner.os }}-15-${{ hashFiles('**/yarn.lock') }}
- name: Install Deps
run: yarn
- name: Run ESLint
run: yarn lint --fix=false
CodeQL:
name: Codequality
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Testing:
name: Unit Tests
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js v15
uses: actions/setup-node@v2
with:
node-version: 15
- name: Restore CI Cache
uses: actions/cache@v2.1.4
with:
path: node_modules
key: ${{ runner.os }}-15-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn
- name: Run Jest
run: yarn test
Building:
name: Compiling TypeScript
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js 15
uses: actions/setup-node@v2
with:
node-version: 15
- name: Restore CI Cache
uses: actions/cache@v2.1.4
with:
path: node_modules
key: ${{ runner.os }}-15-${{ hashFiles('**/yarn.lock') }}
- name: Install Deps
run: yarn
- name: Build Code
run: yarn build