-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Create unit tests workflow (#1910)
* chore: Update for Rust 1.72.0 Rust 1.72.0 has introduced a bunch of new lints. Here we fix them all. `let ... else` finally gets formatted. * chire: Create unit tests workflow * Rename and remove useless steps * remove env vars * Add concurrency group * Test unit workflow on 4 cores --------- Co-authored-by: chubei <914745487@qq.com>
- Loading branch information
1 parent
de3d0c1
commit a1d6ee8
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
# pull_request_target: | ||
# branches: [main] | ||
merge_group: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
concurrency: | ||
group: ci/${{ github.ref }} | ||
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 unit tests | ||
unit: | ||
timeout-minutes: 60 | ||
runs-on: | ||
group: Org Larger Runners | ||
labels: ubuntu-latest-4-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 | ||
mysql: | ||
image: mysql:8 | ||
ports: | ||
- 3306:3306 | ||
env: | ||
MYSQL_ROOT_PASSWORD: mysql | ||
MYSQL_ROOT_HOST: '%' | ||
MYSQL_DATABASE: test | ||
options: >- | ||
--health-cmd "mysqladmin ping -uroot --password=mysql" | ||
--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 Protoc | ||
uses: arduino/setup-protoc@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Rust cache | ||
uses: swatinem/rust-cache@v2 | ||
|
||
- name: MongoDB in GitHub Actions | ||
uses: supercharge/mongodb-github-action@1.8.0 | ||
|
||
- uses: ./.github/workflows/setup-snowflake-and-kafka | ||
|
||
- name: Run connectors tests | ||
env: | ||
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 | ||
shell: bash | ||
run: | | ||
source ./dozer-tests/python_udf/virtualenv.sh | ||
cargo test --features snowflake,ethereum,kafka,python,mongodb --no-fail-fast | ||