forked from supabase/etl
-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (155 loc) · 4.86 KB
/
ci.yml
File metadata and controls
183 lines (155 loc) · 4.86 KB
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
174
175
176
177
178
179
180
181
182
183
name: CI
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check:
name: Lint
runs-on: blacksmith-2vcpu-ubuntu-2404
strategy:
matrix:
check: [fmt, clippy, sort]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.88.0
with:
components: ${{ matrix.check == 'fmt' && 'rustfmt' || 'clippy' }}
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.check }}
- name: Install cargo-sort
if: matrix.check == 'sort'
run: cargo install cargo-sort
- name: Run Cargo Fmt
if: matrix.check == 'fmt'
run: cargo fmt --check
- name: Run Cargo Clippy
if: matrix.check == 'clippy'
run: cargo clippy --all-targets --all-features --no-deps -- -D warnings
- name: Run Cargo Sort
if: matrix.check == 'sort'
run: cargo sort --workspace --grouped --check
test-partial:
name: Tests (Partial)
runs-on: blacksmith-2vcpu-ubuntu-2404
# Run on forks.
if: github.event.pull_request.head.repo.fork == true
permissions:
contents: read
strategy:
matrix:
postgres_version: [17, 16, 15, 14]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.88.0
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
key: test-partial
- name: Start Docker Compose (Postgres ${{ matrix.postgres_version }})
run: |
POSTGRES_VERSION=${{ matrix.postgres_version }} docker compose -f ./scripts/docker-compose.yaml up -d
- name: Install sqlx-cli
run: |
cargo install sqlx-cli \
--features native-tls,postgres \
--no-default-features \
--locked
- name: Migrate Database
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_PORT: 5430
POSTGRES_HOST: localhost
run: |
sudo apt-get install libpq-dev -y
./etl-api/scripts/run_migrations.sh
- name: Run Tests
run: |
cargo test \
--workspace \
--all-features \
--no-fail-fast \
--exclude etl-destinations \
&& \
cargo test \
-p etl-destinations \
--no-default-features \
--no-fail-fast \
--features iceberg
test-full:
name: Tests (Full)
runs-on: blacksmith-2vcpu-ubuntu-2404
# Run on non-forks.
if: github.event.pull_request.head.repo.fork == false
permissions:
contents: read
id-token: write
strategy:
matrix:
postgres_version: [17, 16, 15, 14]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.88.0
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
key: test-full
- name: Start Docker Compose (Postgres ${{ matrix.postgres_version }})
run: |
POSTGRES_VERSION=${{ matrix.postgres_version }} docker compose -f ./scripts/docker-compose.yaml up -d
- name: Install sqlx-cli
run: |
cargo install sqlx-cli \
--features native-tls,postgres \
--no-default-features \
--locked
- name: Migrate Database
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_PORT: 5430
POSTGRES_HOST: localhost
run: |
sudo apt-get install libpq-dev -y
./etl-api/scripts/run_migrations.sh
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Set up BigQuery Credentials
run: |
printf '%s' '${{ secrets.TESTS_BIGQUERY_SA_KEY_JSON }}' > /tmp/bigquery-sa-key.json
echo "TESTS_BIGQUERY_PROJECT_ID=${{ secrets.TESTS_BIGQUERY_PROJECT_ID }}" >> $GITHUB_ENV
echo "TESTS_BIGQUERY_SA_KEY_PATH=/tmp/bigquery-sa-key.json" >> $GITHUB_ENV
- name: Generate Code Coverage
id: coverage
run: |
cargo llvm-cov test \
--workspace --no-fail-fast \
--all-features \
--lcov --output-path lcov.info
- name: Upload Coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
fail-on-error: false
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
debug: true