Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI and some tests #19

Merged
merged 41 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
70671ff
Fix lint errors
Lun4m Jun 17, 2024
437b07a
Move main logic to lib file
Lun4m Jun 17, 2024
9a1d71e
Wrap nullable types in Option
Lun4m Jun 17, 2024
cd21a12
Fix regex and how we handle its matches
Lun4m Jun 17, 2024
e3cc474
Use NaiveDateTime to parse Obsinn timestamps
Lun4m Jun 17, 2024
088bae3
Return an error if there is no data
Lun4m Jun 17, 2024
4ccaba2
Fix SQL queries in filter_and_label_kldata
Lun4m Jun 17, 2024
44fb963
Add unit tests for kldata
Lun4m Jun 17, 2024
1d448a9
Add binary to populate a test database
Lun4m Jun 17, 2024
469ba38
Add common functions for integration tests
Lun4m Jun 17, 2024
d767686
Add api integration tests
Lun4m Jun 17, 2024
f36a9ec
Add ingestion integration tests
Lun4m Jun 17, 2024
fcc7847
Add end-to-end integration tests
Lun4m Jun 17, 2024
9543247
Add github workflow
Lun4m Jun 17, 2024
2ed3893
Make timeseries creation easier to understand
Lun4m Jun 18, 2024
4c8e05b
Update TODOs
Lun4m Jun 19, 2024
cdcd543
Add makefile to run tests locally
Lun4m Jun 19, 2024
68d4386
prepare_db now only creates the schemas
Lun4m Jun 21, 2024
d3473b4
Condense everything in single file
Lun4m Jun 21, 2024
487d747
Add stations to mock
Lun4m Jun 21, 2024
56ad179
Mark location as Option
Lun4m Jun 24, 2024
fdf65ce
Add helpful log for tests
Lun4m Jun 24, 2024
2269dc3
Final merge
Lun4m Jun 24, 2024
162c062
Change workspace path
Lun4m Jun 24, 2024
3ce2acc
Remove unused impl block
Lun4m Jun 24, 2024
628c795
cfg(test) does not apply to integration tests, we specify a separate …
Lun4m Jun 24, 2024
f559b58
Clean up comments
Lun4m Jun 25, 2024
34003d1
Join headers only at the end
Lun4m Jun 25, 2024
1f9afbc
Get rid of the bin directory
Lun4m Jun 25, 2024
a2e1b89
Use futures crate already available in the workspace
Lun4m Jun 25, 2024
d8e0a02
Update timeslice test
Lun4m Jun 26, 2024
9084788
Update file name
Lun4m Jun 26, 2024
6048f58
Clean up makefile
Lun4m Jun 27, 2024
4b73813
Make database clean up conditional for debugging
Lun4m Jun 28, 2024
a2e3b04
Small fixes
Lun4m Jul 1, 2024
a4468c6
Clean up main.rs
Lun4m Jul 1, 2024
8f49c0c
Reuse structs that were already implemented
Lun4m Jul 1, 2024
f0e4a6d
Add README.md for integration tests
Lun4m Jul 1, 2024
ea7a91a
Minor changes
Lun4m Jul 2, 2024
11a656d
Formatting
Lun4m Jul 2, 2024
bfba2b3
Revert struct fields privacy changes
Lun4m Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Continuous integration

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest

services:
postgres:
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432

steps:
- uses: actions/checkout@v4

- name: Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: Run cargo check
run: cargo check

- name: Formatting check
run: cargo fmt --all -- --check

- name: Build
run: cargo build --workspace --tests

- name: Lint
run: cargo clippy --workspace -- -D warnings

- name: Prepare PostgreSQL
run: target/debug/prepare_db

- name: Run unit and integration tests
run: cargo test --no-fail-fast -- --nocapture --test-threads=1

# TODO: potentially we can split them up in multiple steps
# - name: Prepare PostgreSQL for API tests
# run: target/debug/prepare_db api

# - name: API integration tests
# run: cargo test --test api -- --nocapture --test-threads=1

# - name: Prepare PostgreSQL for ingestion tests
# run: target/debug/prepare_db ingestion

# - name: Ingestions integration tests
# run: cargo test --test ingestion -- --nocapture --test-threads=1

# - name: Prepare PostgreSQL for E2E tests
# run: target/debug/prepare_db end-to-end

# - name: E2E integration tests
# run: cargo test --test end-to-end -- --nocapture --test-threads=1
Loading
Loading