Skip to content

Commit 11172ba

Browse files
authored
Merge pull request #448 from loopbackio/actions
ci: add GitHub Actions
2 parents 5d72993 + 584f0c5 commit 11172ba

File tree

4 files changed

+224
-2
lines changed

4 files changed

+224
-2
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Continous Integration
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
# The branches below must be a subset of the branches above
7+
branches: [master]
8+
9+
env:
10+
CI: true
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-18.04
15+
strategy:
16+
matrix:
17+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
18+
node-version: [12, 14, 16]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
- uses: ankane/setup-mysql@v1
26+
with:
27+
mysql-version: 5.7
28+
- run: |
29+
sudo mysql -e "CREATE USER '${{ secrets.MYSQL_USER }}'@'localhost' IDENTIFIED BY '${{ secrets.MYSQL_PASSWORD }}'"
30+
sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${{ secrets.MYSQL_USER }}'@'localhost'"
31+
sudo mysql -u root -e "ALTER USER '${{ secrets.MYSQL_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password by '${{ secrets.MYSQL_PASSWORD }}'"
32+
sudo mysql -u root -e "FLUSH PRIVILEGES"
33+
- run: npm install
34+
- run: npm test
35+
env:
36+
MYSQL_USER: ${{ secrets.MYSQL_USER }}
37+
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
38+
CI: true
39+
code-lint:
40+
name: Code Lint
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 60
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: Use Node.js 14
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: 14
49+
- name: Bootstrap project
50+
run: |
51+
npm ci --ignore-scripts
52+
- name: Verify code linting
53+
run: npm run lint
54+
55+
commit-lint:
56+
name: Commit Lint
57+
runs-on: ubuntu-latest
58+
timeout-minutes: 60
59+
steps:
60+
- uses: actions/checkout@v2
61+
with:
62+
fetch-depth: 0
63+
- name: Use Node.js 14
64+
uses: actions/setup-node@v2
65+
with:
66+
node-version: 14
67+
- name: Bootstrap project
68+
run: |
69+
npm ci --ignore-scripts
70+
- name: Verify commit linting
71+
run: npx commitlint --from origin/master --to HEAD --verbose

commitlint.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
2+
// Node module: loopback4-example-shopping-monorepo
3+
// This file is licensed under the MIT License.
4+
// License text available at https://opensource.org/licenses/MIT
5+
6+
'use strict';
7+
8+
module.exports = {
9+
extends: [
10+
'@commitlint/config-conventional',
11+
],
12+
rules: {
13+
'header-max-length': [2, 'always', 100],
14+
'body-leading-blank': [2, 'always'],
15+
'footer-leading-blank': [0, 'always'],
16+
'signed-off-by': [2, 'always', 'Signed-off-by:'],
17+
},
18+
};

package-lock.json

Lines changed: 133 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"mocha": "^8.1.2",
3737
"rc": "^1.0.0",
3838
"should": "^13.2.3",
39-
"sinon": "^9.0.3"
39+
"sinon": "^9.0.3",
40+
"@commitlint/config-conventional": "^12.1.4"
4041
},
4142
"repository": {
4243
"type": "git",

0 commit comments

Comments
 (0)