-
Notifications
You must be signed in to change notification settings - Fork 125
173 lines (151 loc) · 5.71 KB
/
coverage.yaml
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Dozer Coverage
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
env:
CARGO_TERM_COLOR: always
concurrency:
group: coverage/${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for actions/checkout
jobs:
# Run coverage
coverage:
timeout-minutes: 60
runs-on:
group: Org Larger Runners
labels: ubuntu-latest-16-cores
services:
postgres:
image: debezium/postgres:13
ports:
- 5434:5432
env:
POSTGRES_DB: dozer_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ALLOW_IP_RANGE: 0.0.0.0/0
# command: postgres -c hba_file=/var/lib/stock-sample/pg_hba.conf
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: dozer-coverage
aws-region: us-east-2
- if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- if: github.event_name != 'pull_request_target'
uses: actions/checkout@v3
- name: Install stable with llvm-tools-preview
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: llvm-tools-preview
- name: Download grcov
run: |
mkdir target
wget -O target/grcov https://dozer-ci.s3.ap-southeast-1.amazonaws.com/grcov-linux-amd64-v0.8.13
chmod +x target/grcov
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: ⚡ Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/.package-cache
~/.cargo/registry/
~/.cargo/git/db/
target/
key: coverage-${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
coverage-${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
coverage-${{ runner.os }}-cargo-
- name: MongoDB in GitHub Actions
uses: supercharge/[email protected]
- uses: ./.github/workflows/setup-snowflake-and-kafka
- uses: ./.github/workflows/setup-mysql-and-mariadb
- name: Run connectors tests
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
SN_SERVER: ${{ secrets.SN_SERVER }}
SN_USER: ${{ secrets.SN_USER }}
SN_PASSWORD: ${{ secrets.SN_PASSWORD }}
SN_DATABASE: ${{ secrets.SN_DATABASE }}
SN_WAREHOUSE: ${{ secrets.SN_WAREHOUSE }}
SN_DRIVER: ${{ secrets.SN_DRIVER }}
shell: bash
run: |
cargo test test_connector_ --lib --features snowflake,ethereum,kafka,python --no-fail-fast -- --ignored
- name: Run tests
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
shell: bash
run: |
source ./dozer-tests/python_udf/virtualenv.sh
cargo test --features snowflake,ethereum,kafka,python,mongodb --no-fail-fast
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- id: coverage
run: |
./target/grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" --ignore 'target/*' --ignore 'dozer-tests/*' -o coverage.lcov
echo "::set-output name=report::coverage.lcov"
- uses: actions/upload-artifact@v3
with:
name: coverage
path: |
${{ steps.coverage.outputs.report }}
retention-days: 10
- if: github.event_name == 'pull_request_target'
name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
git-commit: ${{ github.event.pull_request.head.sha }}
- if: github.event_name != 'pull_request_target'
name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
discord_notification:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_GITHUB_WEBOOK }}
DISCORD_EMBEDS: '[ {
"title": " ${{ github.actor }} pushed to `${{ github.ref_name }}` :rocket:",
"author": { "icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{ github.actor }}" },
"fields": [
{ "name": "Commit", "value": "[${{ github.event.head_commit.id }}](${{ github.event.head_commit.url }})"},
{ "name": "Repository", "value": "[getdozer/dozer](https://github.com/getdozer/dozer)" },
{ "name": "Message", "value": ${{ toJSON(github.event.head_commit.message) }}}
],
"color": 990099
}]'
uses: Ilshidur/action-discord@master