Skip to content

Commit 2fead46

Browse files
authored
Merge pull request #14 from lightninglabs/ci/add-github-actions
add GitHub Actions CI workflow
2 parents b4c31ec + cebbf53 commit 2fead46

File tree

6 files changed

+136
-2
lines changed

6 files changed

+136
-2
lines changed

.github/workflows/main.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
jobs:
12+
test:
13+
name: nodejs v${{ matrix.node_version }} on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
matrix:
18+
node_version: [10.x, 12.x]
19+
os: [ubuntu-latest, windows-latest, macOS-latest]
20+
21+
steps:
22+
- name: set git config
23+
run: |
24+
git config --global core.eol lf
25+
git config --global core.autocrlf false
26+
27+
- uses: actions/checkout@v1
28+
29+
- name: setup nodejs
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: ${{ matrix.node_version }}
33+
34+
- name: install yarn
35+
run: npm install -g yarn
36+
37+
- name: get yarn cache dir
38+
id: yarn-cache-dir
39+
run: echo "::set-output name=dir::$(yarn cache dir)"
40+
41+
- uses: actions/cache@v1
42+
id: yarn-cache
43+
with:
44+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
45+
key: ${{ runner.os }}-${{ runner.node_version }}-yarn-${{ hashFiles('**/yarn.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-${{ runner.node_version }}-yarn-
48+
49+
- name: install dependencies
50+
working-directory: ./app
51+
run: yarn
52+
53+
- name: lint code
54+
working-directory: ./app
55+
run: yarn lint
56+
57+
- name: typescript compile
58+
working-directory: ./app
59+
run: yarn tsc
60+
61+
- name: unit tests
62+
working-directory: ./app
63+
run: yarn test:ci
64+
65+
- name: build app
66+
working-directory: ./app
67+
run: yarn build

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@
6262
],
6363
"editor.codeActionsOnSave": {
6464
"source.fixAll.eslint": true
65-
}
65+
},
66+
"eslint.workingDirectories": ["./app"]
6667
}

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
> This document is currently a scratchpad for developer setup and temporary hacks to run the project. It will be made more user-friendly in the future
22
3+
![CI](https://github.com/lightninglabs/shushtar/workflows/CI/badge.svg)
4+
35
Requirements: [Go](https://golang.org/doc/install), [protoc](https://github.com/protocolbuffers/protobuf/releases), [nodejs](https://nodejs.org/en/download/)
46

57
## One-time Setup

app/.eslintignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# testing
2+
/coverage
3+
4+
# production
5+
/build
6+
7+
# generated from GRPC proto compiler
8+
/src/types/generated/
9+
10+
# mocks for dependencies
11+
/src/__mocks__

app/package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
"start": "BROWSER=none react-scripts start",
99
"build": "react-scripts build",
1010
"test": "react-scripts test",
11-
"test:ci": "CI=true yarn test --coverage",
11+
"test:ci": "cross-env CI=true yarn test --coverage",
1212
"eject": "react-scripts eject",
13+
"lint": "eslint --ext .ts,.tsx --ignore-path .eslintignore .",
14+
"tsc": "tsc --noEmit",
1315
"protos": "./scripts/build-protos.sh"
1416
},
1517
"proxy": "https://localhost:8443",
@@ -37,6 +39,10 @@
3739
"@types/react-dom": "^16.9.0",
3840
"@typescript-eslint/eslint-plugin": "^2.27.0",
3941
"@typescript-eslint/parser": "^2.27.0",
42+
"cross-env": "7.0.2",
43+
"eslint-config-prettier": "6.10.1",
44+
"eslint-plugin-prettier": "3.1.3",
45+
"eslint-plugin-react": "7.19.0",
4046
"google-protobuf": "3.11.4",
4147
"prettier": "2.0.4",
4248
"ts-protoc-gen": "0.12.0",

app/yarn.lock

+47
Original file line numberDiff line numberDiff line change
@@ -3164,6 +3164,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
31643164
safe-buffer "^5.0.1"
31653165
sha.js "^2.4.8"
31663166

3167+
3168+
version "7.0.2"
3169+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9"
3170+
integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==
3171+
dependencies:
3172+
cross-spawn "^7.0.1"
3173+
31673174
31683175
version "7.0.1"
31693176
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14"
@@ -3184,6 +3191,15 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
31843191
shebang-command "^1.2.0"
31853192
which "^1.2.9"
31863193

3194+
cross-spawn@^7.0.1:
3195+
version "7.0.2"
3196+
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.2.tgz#d0d7dcfa74e89115c7619f4f721a94e1fdb716d6"
3197+
integrity sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==
3198+
dependencies:
3199+
path-key "^3.1.0"
3200+
shebang-command "^2.0.0"
3201+
which "^2.0.1"
3202+
31873203
crypto-browserify@^3.11.0:
31883204
version "3.12.0"
31893205
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
@@ -3944,6 +3960,13 @@ escodegen@^1.11.0, escodegen@^1.9.1:
39443960
optionalDependencies:
39453961
source-map "~0.6.1"
39463962

3963+
3964+
version "6.10.1"
3965+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.1.tgz#129ef9ec575d5ddc0e269667bf09defcd898642a"
3966+
integrity sha512-svTy6zh1ecQojvpbJSgH3aei/Rt7C6i090l5f2WQ4aB05lYHeZIR1qL4wZyyILTbtmnbHP5Yn8MrsOJMGa8RkQ==
3967+
dependencies:
3968+
get-stdin "^6.0.0"
3969+
39473970
eslint-config-react-app@^5.2.1:
39483971
version "5.2.1"
39493972
resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-5.2.1.tgz#698bf7aeee27f0cea0139eaef261c7bf7dd623df"
@@ -4018,6 +4041,13 @@ [email protected]:
40184041
has "^1.0.3"
40194042
jsx-ast-utils "^2.2.1"
40204043

4044+
4045+
version "3.1.3"
4046+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.3.tgz#ae116a0fc0e598fdae48743a4430903de5b4e6ca"
4047+
integrity sha512-+HG5jmu/dN3ZV3T6eCD7a4BlAySdN7mLIbJYo0z1cFQuI+r2DiTJEFeF68ots93PsnrMxbzIZ2S/ieX+mkrBeQ==
4048+
dependencies:
4049+
prettier-linter-helpers "^1.0.0"
4050+
40214051
eslint-plugin-react-hooks@^1.6.1:
40224052
version "1.7.0"
40234053
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz#6210b6d5a37205f0b92858f895a4e827020a7d04"
@@ -4341,6 +4371,11 @@ fast-deep-equal@^3.1.1:
43414371
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4"
43424372
integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==
43434373

4374+
fast-diff@^1.1.2:
4375+
version "1.2.0"
4376+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
4377+
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
4378+
43444379
fast-glob@^2.0.2:
43454380
version "2.2.7"
43464381
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d"
@@ -4704,6 +4739,11 @@ get-own-enumerable-property-symbols@^3.0.0:
47044739
resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664"
47054740
integrity sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==
47064741

4742+
get-stdin@^6.0.0:
4743+
version "6.0.0"
4744+
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b"
4745+
integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==
4746+
47074747
get-stream@^4.0.0:
47084748
version "4.1.0"
47094749
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5"
@@ -8309,6 +8349,13 @@ prepend-http@^1.0.0:
83098349
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
83108350
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
83118351

8352+
prettier-linter-helpers@^1.0.0:
8353+
version "1.0.0"
8354+
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
8355+
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
8356+
dependencies:
8357+
fast-diff "^1.1.2"
8358+
83128359
83138360
version "2.0.4"
83148361
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.4.tgz#2d1bae173e355996ee355ec9830a7a1ee05457ef"

0 commit comments

Comments
 (0)