-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (130 loc) · 4.34 KB
/
build.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
130
131
132
133
134
135
name: Build, Test and Deploy
on:
pull_request:
push:
branches: ["main", "beta"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 14.21.3
cache: 'yarn'
- name: Cache node_modules
uses: actions/cache@v3
id: cache-primes
with:
path: "**/node_modules"
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.cache-primes.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --non-interactive --production=false
- name: Lint commit message
uses: wagoid/commitlint-github-action@456526eec71276a59e74aafdfe06a9632ac2eee1
- name: Lint javascript and typescript
run: yarn lint
build:
name: Build
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.21.2
cache: 'yarn'
- name: Cache node_modules
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Build
run: yarn build
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [lint]
strategy:
matrix:
node: [14, 16, 18, 20]
include:
- node: 14
withCoverage: ${{ true }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Cache node_modules
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Login on dockerhub
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Start docker container
run: docker-compose up -d; sleep 15
- name: Test with Node ${{ matrix.node }}
if: ${{ !matrix.withCoverage }}
run: yarn test
- name: Test with Node ${{ matrix.node }} & Send coverage
uses: paambaati/codeclimate-action@5f637ccd517bc8960de0fe59379dd922bcba9486
if: matrix.withCoverage && matrix.node == 14
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: yarn test:coverage
- name: Test prepack
run: yarn prepack
- name: Test postpack
run: yarn postpack
deploy:
name: Release package
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [build, test]
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta')
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
persist-credentials: false # GITHUB_TOKEN must not be set for the semantic release
- uses: actions/setup-node@v3
with:
node-version: 14.21.2
cache: 'yarn'
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Build
run: yarn build
- name: Get Semantic Release current version
id: semantic_version
run: |
VERSION=`node -p "require('./package.json').devDependencies['semantic-release']"`
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Semantic Release
uses: cycjimmy/semantic-release-action@7f0c0e4904fb36f980686dda081f2f258500f3ea
id: semantic
with:
semantic_version: ${{ steps.semantic_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}