Skip to content

Commit 5d90f16

Browse files
committed
ci: add github actions
1 parent 0616929 commit 5d90f16

File tree

4 files changed

+163
-22
lines changed

4 files changed

+163
-22
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Version tags only
2+
3+
name: Release
4+
5+
on:
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
publish:
11+
name: Publish
12+
runs-on: ubuntu-latest
13+
env:
14+
# Ensure release notes are published by our `serverless-ci` bot
15+
# (If instead we'd use unconditionally provided secrets.GITHUB_TOKEN then
16+
# "github-actions" user will be listed as release publisher)
17+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v2
21+
22+
- name: Install Node.js and npm
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: 14.x
26+
registry-url: https://registry.npmjs.org
27+
28+
- name: Retrieve dependencies from cache
29+
id: cacheNpm
30+
uses: actions/cache@v2
31+
with:
32+
path: |
33+
~/.npm
34+
node_modules
35+
key: npm-v14-${{ runner.os }}-refs/heads/master-${{ hashFiles('package.json') }}
36+
restore-keys: npm-v14-${{ runner.os }}-refs/heads/master-
37+
38+
- name: Install dependencies
39+
if: steps.cacheNpm.outputs.cache-hit != 'true'
40+
run: |
41+
npm update --no-save
42+
npm update --save-dev --no-save
43+
- name: Releasing
44+
run: |
45+
npm run release
46+
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
47+
# as it appears actions/setup-node sets own value
48+
env:
49+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # 01dd......71cc

.github/workflows/test.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: IntegrationTest
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
push:
7+
paths:
8+
- 'src/**'
9+
10+
jobs:
11+
IntegrationTest:
12+
name: Integration Tests
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
with:
18+
# Ensure connection with 'master' branch
19+
fetch-depth: 2
20+
21+
- name: Install Node.js and npm
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: 14.x
25+
registry-url: https://registry.npmjs.org
26+
27+
- name: Retrieve dependencies from cache
28+
id: cacheNpm
29+
uses: actions/cache@v2
30+
with:
31+
path: |
32+
~/.npm
33+
node_modules
34+
key: npm-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
35+
restore-keys: |
36+
npm-v14-${{ runner.os }}-${{ github.ref }}-
37+
npm-v14-${{ runner.os }}-refs/heads/master-
38+
39+
- name: Install dependencies
40+
if: steps.cacheNpm.outputs.cache-hit != 'true'
41+
run: |
42+
npm update --no-save
43+
npm update --save-dev --no-save
44+
- name: Running integration tests
45+
run: npm run test
46+
env:
47+
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID}}
48+
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY}}
49+
TENCENT_UIN: ${{ secrets.TENCENT_UIN}}
50+
TENCENT_APP_ID: ${{ secrets.TENCENT_APP_ID}}
51+
BUCKET: ${{ secrets.BUCKET}}
52+
DOMAIN: ${{ secrets.DOMAIN}}
53+
SUB_DOMAIN: ${{ secrets.SUB_DOMAIN}}
54+
REGION: ${{ secrets.REGION}}
55+
ZONE: ${{ secrets.ZONE}}
56+
VPC_ID: ${{ secrets.VPC_ID}}
57+
SUBNET_ID: ${{ secrets.SUBNET_ID}}
58+
CFS_VPC_ID: ${{ secrets.CFS_VPC_ID}}
59+
CFS_SUBNET_ID: ${{ secrets.CFS_SUBNET_ID}}

.github/workflows/validate.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Validate
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
lintAndFormatting:
11+
name: Lint & Formatting
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
16+
with:
17+
# Ensure connection with 'master' branch
18+
fetch-depth: 2
19+
20+
- name: Install Node.js and npm
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: 14.x
24+
registry-url: https://registry.npmjs.org
25+
26+
- name: Retrieve last master commit (for `git diff` purposes)
27+
run: |
28+
git checkout -b pr
29+
git fetch --prune --depth=20 origin +refs/heads/master:refs/remotes/origin/master
30+
git checkout master
31+
git checkout pr
32+
33+
- name: Retrieve dependencies from cache
34+
id: cacheNpm
35+
uses: actions/cache@v2
36+
with:
37+
path: |
38+
~/.npm
39+
node_modules
40+
key: npm-v14-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
41+
restore-keys: |
42+
npm-v14-${{ runner.os }}-${{ github.ref }}-
43+
npm-v14-${{ runner.os }}-refs/heads/master-
44+
45+
- name: Install dependencies
46+
if: steps.cacheNpm.outputs.cache-hit != 'true'
47+
run: |
48+
npm update --no-save
49+
npm update --save-dev --no-save
50+
51+
- name: Validate Formatting
52+
run: npm run prettier:fix
53+
54+
- name: Validate Lint rules
55+
run: npm run lint:fix

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)