Skip to content

Commit c231aca

Browse files
committed
ci: setup multiple ci for v1 and v2 [ci skip]
1 parent 9ada710 commit c231aca

File tree

4 files changed

+72
-5
lines changed

4 files changed

+72
-5
lines changed

.github/workflows/ci.yml renamed to .github/workflows/build_v1.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
name: build
1+
name: build_v1
22
on:
33
push:
44
branches:
55
- main
6+
paths-ignore:
7+
- 'v2/**'
68
pull_request:
79
jobs:
810
checks:
@@ -31,7 +33,7 @@ jobs:
3133
uses: morphy2k/revive-action@v2
3234

3335
- name: build
34-
run: ./scripts/test.sh
36+
run: ./scripts/test_v1.sh
3537
env:
3638
LARK_APP_ID: ${{ secrets.LARK_APP_ID }}
3739
LARK_APP_SECRET: ${{ secrets.LARK_APP_SECRET }}

.github/workflows/build_v2.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: build_v2
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'v2/**'
8+
pull_request:
9+
jobs:
10+
checks:
11+
name: run
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: checkout
15+
uses: actions/checkout@v3
16+
17+
- name: cache
18+
uses: actions/cache@v3
19+
with:
20+
path: |
21+
~/.cache/go-build
22+
~/go/pkg/mod
23+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
24+
restore-keys: |
25+
${{ runner.os }}-go-
26+
27+
- name: setup
28+
uses: actions/setup-go@v3
29+
with:
30+
go-version: '1.13.0'
31+
32+
- name: lint
33+
uses: morphy2k/revive-action@v2
34+
35+
- name: build
36+
run: ./scripts/test_v2.sh
37+
env:
38+
LARK_APP_ID: ${{ secrets.LARK_APP_ID }}
39+
LARK_APP_SECRET: ${{ secrets.LARK_APP_SECRET }}
40+
LARK_USER_EMAIL: ${{ secrets.LARK_USER_EMAIL }}
41+
LARK_CHAT_ID: ${{ secrets.LARK_CHAT_ID }}
42+
LARK_OPEN_ID: ${{ secrets.LARK_OPEN_ID }}
43+
LARK_USER_ID: ${{ secrets.LARK_USER_ID }}
44+
LARK_UNION_ID: ${{ secrets.LARK_UNION_ID }}
45+
LARK_MESSAGE_ID: ${{ secrets.LARK_MESSAGE_ID }}
46+
LARK_WEBHOOK: ${{ secrets.LARK_WEBHOOK_V2 }}
47+
LARK_WEBHOOK_SIGNED: ${{ secrets.LARK_WEBHOOK_V2_SIGNED }}
48+
49+
- name: codecov
50+
uses: codecov/codecov-action@v1
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22

33
set -e
4-
echo "mode: atomic" > coverage.txt
4+
echo "mode: atomic" >coverage.txt
55

66
go test -coverprofile=profile.out -covermode=atomic ./...
77
if [ -f profile.out ]; then
8-
tail -q -n +2 profile.out >> coverage.txt
9-
rm profile.out
8+
tail -q -n +2 profile.out >>coverage.txt
9+
rm profile.out
1010
fi
1111

1212
go tool cover -func coverage.txt

scripts/test_v2.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
echo "mode: atomic" >coverage.txt
5+
6+
cd ./v2
7+
go test -coverprofile=profile.out -covermode=atomic ./...
8+
if [ -f profile.out ]; then
9+
tail -q -n +2 profile.out >>coverage.txt
10+
rm profile.out
11+
fi
12+
13+
go tool cover -func coverage.txt

0 commit comments

Comments
 (0)