Skip to content

Commit df48451

Browse files
TheRustifyergbm25
andauthored
Merge from main (#30)
* Setted up action for autopublish tests results. Due to the incompatibility of upload-tests-results-actions with the XML output, will stay deactivated until a solution is found * # Setting up testing actions, generate unit tests for the projects, correct clippy warnings and format according rustfmt (#21) * #feature - setting up worflows for multiple different OS and Rust versions * #feature - code-quality workflow for lint with Clippy, and formatting with rustfmt. OS independent tests only gets triggered on push tags, just for reflecting the status badge for every new release. A new continuous-integration workflow runs now on every push and PR, being the default required statuses to pass before do anything against the main branch * #feature Added cache for multiple jobs on the new workflows * #Fix - Solved clippy warnings on the project * #feature - formatted project with rustmt * #feature - psql docker now has config for have an static ip * #feature - Integration Tests for the base CRUD operations available in Canyon-SQL. * #fix - Corrected macro paths to canyon_sql::bounds on the macro insert operations generator * #feature - Curated the reexports for redesing the public API of the library from the crate * Removed the complete reexport of . Now it's reexported only the necessary elements * #features - cleaned and upgraded the reexports of the public API. Procedures created to create tables on the SQL server client * Trying to transmute instances of DatabaseConnection from &self obtained from the map of cached connections to &mut self * Why tests passes?! * Playing with the behaviour of 'block_on()' in different contexts of the framework * Implemented the connection cache manager for every datasource * Using the datasource variants to check against the MSSQL * #feature - Reworked the canyon macro -> main, that now runs the custom created tokio runtime. Test macro also works with the custom runtime. The cache connections initializer now its runned inside the macros and it's allowed to be async * #refactor - canyon_manager crate removed from the project. The manager module are now in canyon_observer, reducing project structure complexity * [NON WORKING] - Preview of the first changes of the migrations API * [WIP] - Mapped unordered metadata rows into one comprehensive struct * [WIP] - Removing intermediate data structures to parse the metadata information * Debug logs for the row retriever * Correction over the concrete column entity generation * Finished the refactor of the information schema parser * Minor corrections on the memory process * CanyonMemoryRows holds references in its process * Canyon memory now works with both PostgreSQL and MSSQL without issues * First refactorings of the rename tables entity name operations * #fix - Renamed tables now are included as candidates for migrations * Removed properties from TableMetadata that aren't relevant for the migrations process nowadays. Initialized a new tests module for the MigrationsHelper * Debugging points for the base first operation, create or rename tables * ALTER TABLE SqlServer version for migrations * Reworking the constant values on the translations from Rust types to database column types * WIP - Pursuing a .value() on a Option<String> * #fix - Foreignkeyable refactor. The foreign key reverse lookage now receive the query parameters as &dyn QueryParameters and the query is full parametrized * WIP - Entering on madness zone 'cause of SQL SERVER way of deleting a column * Non hardcoded values for column names on delete defaul constraint * Correction on the MS SQL rename table migration query. Cleaned up runtime query log of migrations query. Annotated as dead_code new written code not used yet * Solved an issue with past changes that was a function arg that was specting &str and we change the arg type to std::String * The QueryBuilder now has it's parameters non hardcoded as strings, are parametrized from &dyn QueryParameters * <TypeName>Field::field_name FieldName autogenerated enum now it's able to work without manually implement the Display trait * Small corrections * WIP - Base implementation of the hierarchy of the diff QueryBuilder implementation types * WIP - Megarefactor of the QueryBuilder. SelectQueryBuilder has now join operations. Removed fields from the QueryBuilder, so the sql generated by the builder method calls are directly stored in the underlying string of the Query member of the QueryBuilder. Trait bounds for the comparison operators, allowing impl Operator in method arguments * More refactor to the QB * Standarized the SelectQueryBuilder * Query impl on the BaseQueryBuilder type is removed from the interface. Natural impl blocks contain now a wrapper to call the query() method on the inner QueryBuilder and query the database targeted by the specified datasource * Update and delete operations created with the QueryBuilder got it's concrete types for themselves, with it's unique kind of operations * Accessors (as read only member methods) and mutators (for wire user desired arbitrary data into the sql) for every concrete implementation of the querybuilder * and_in BaseQueryBuilder method gets completed and added to the trait. BaseQueryBuilder trait get it's members documented * BaseQueryBuilder type it's renamed to QueryBuilder, matching the QueryBuilder struct type, but encapsulated in the ops:: module * First unit tests for the SQL generated by the builder method calls * WIP Partial refactoring of migrations (add constraints). Co-authored-by: Gonzalo Busto Musi <gonzalo.busto@gmail.com> * WIP Partial refactoring of migrations (logic completed but not tested). Co-authored-by: Gonzalo Busto Musi <gonzalo.busto@gmail.com> * Added provisional conditionals on queries Co-authored-by: Gonzalo Busto Musi <gonzalo.busto@gmail.com> * NOT WORKING - Added logs. Fix query execution. Co-authored-by: Gonzalo Busto Musi <gonzalo.busto@gmail.com> * Fixed level of conditionals for Foreign Key comparison operations * You're just not a Foreign Key honey, sorry about that * Added the case to the migrations when the user desires to add or remove IDENTITY * Migrations are now executed for every datasource designed. Pending to discard entities, or full migrations by specifying it in annotations * Preparing the migrations for being executed by multiple datasources * Migrations caché works now with a lazy_static HashMap that organizes the changes per datasource configured. There's no more String parsing-converison-rewiring, now it's works directly from a TokenStream * Added more database datatypes supported on the migrations. Corrected a bug that was leading to not trigger the database column type * WIP - The QueryBuilder tests are back. Everything works as spected but the SQLSERVER update clause. Pending to review it * UpdateQueryBuilder<T> got finally it's owned .set(...) method to generate SET clauses. Also now is values are parametrized. Tests are reordered and fully reenabled * Preparing the very first initial release, at version 0.0.1, which will be considered the testing crates.io version * Every inner package specifies a version * Added more terminal commands to the bash_aliases * Relaxed restrictions on the type values of the second element of the tuple that are inside the array of the param columns of the set clause,there's no need to pass references * Relaxed the mandatory until now Debug + Clone bounds on the Crud Operations proc macro. Now they're free of that restriction * Included the repo metadata documents * Code formatted with rustfmt * Clippy tolds us that we could do it better, or, at least, rustier * More format. Inserting data into MSSQL docker for the integration tests. Setting up the release action * Upgraded docker-compose * Solving Clippy warnings at the tests module * Reenabling docker-compose on targets different from Linux * Disabling integration tests for MacOS due to not docker-compose support * IT only for Unix based systems Co-authored-by: Gonzalo Busto Musi <gonzalo.busto@gmail.com>
1 parent 58a3569 commit df48451

93 files changed

Lines changed: 7199 additions & 3407 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# CODEOWNERS file for automating PR flows for the project
2+
3+
* @Pyzyryab
4+
* @Gbm25

.github/CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
zerodaycode@tutanota.com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: "\U0001F41B Bug Report"
3+
about: "If something isn't working as expected \U0001F914."
4+
title: ''
5+
labels: 'i: bug'
6+
assignees: ''
7+
---
8+
9+
## Bug Report
10+
11+
### Description
12+
A clear and concise description of what the bug is.
13+
14+
### Steps to reproduce
15+
16+
1. Go to '...'
17+
2. Click on '....'
18+
3. Scroll down to '....'
19+
4. See error
20+
21+
### Expected result
22+
A clear and concise description of what you expected to happen.
23+
24+
### Actual result
25+
What is the actual behaviour you saw?
26+
27+
### Possible solution
28+
<!--- Only if you have suggestions on a fix for the bug -->
29+
30+
### Additional information
31+
For example, screenshots or analysis so far.
32+
33+
### Environment
34+
OS:
35+
Browser:
36+
Stack used and version:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: "\U0001F680 Feature Request"
3+
about: "I have a suggestion! \U0001F642"
4+
title: ''
5+
labels: 'i: enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
## Feature Request
11+
12+
### Is your feature request related to a problem? Please describe.
13+
A clear and concise description of what the problem is. Ex. I have an issue when [...]
14+
15+
### Describe the solution you'd like
16+
A clear and concise description of what you want to happen. Add any considered drawbacks.
17+
18+
### Describe alternatives you've considered
19+
A clear and concise description of any alternative solutions or features you've considered.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: "\U00002753 Question"
3+
about: "I'm trying to figure something out. \U0001F914"
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## Question
11+
12+
What are you trying to understand?

.github/ISSUE_TEMPLATE/refactor.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: "\U0000267B Refactor"
3+
about: "I spotted something we can do better. \U0001F913"
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
## Refactor
11+
12+
Describe the improvement we can make.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## 🚀 Features",
5+
"labels": ["feature"]
6+
},
7+
{
8+
"title": "## 🐛 Fixes",
9+
"labels": ["fix"]
10+
},
11+
{
12+
"title": "## 🧪 Tests",
13+
"labels": ["test"]
14+
},
15+
{
16+
"title": "## 🧪 Tests and some 🪄 Magic",
17+
"labels": ["test", "magic"],
18+
"exclude_labels": ["no-magic"],
19+
"exhaustive": true,
20+
"empty_content": "- no matching PRs"
21+
}
22+
],
23+
"ignore_labels": [
24+
"ignore"
25+
],
26+
"sort": {
27+
"order": "ASC",
28+
"on_property": "mergedAt"
29+
},
30+
"template": "${{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>",
31+
"pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}",
32+
"empty_template": "- no changes",
33+
"label_extractor": [
34+
{
35+
"pattern": "(.) (.+)",
36+
"target": "$1",
37+
"flags": "gu"
38+
},
39+
{
40+
"pattern": "\\[Issue\\]",
41+
"on_property": "title",
42+
"method": "match"
43+
}
44+
],
45+
"duplicate_filter": {
46+
"pattern": "\\[ABC-....\\]",
47+
"on_property": "title",
48+
"method": "match"
49+
},
50+
"transformers": [
51+
{
52+
"pattern": "[\\-\\*] (\\[(...|TEST|CI|SKIP)\\])( )?(.+?)\n(.+?[\\-\\*] )(.+)",
53+
"target": "- $4\n - $6"
54+
}
55+
],
56+
"max_tags_to_fetch": 200,
57+
"max_pull_requests": 200,
58+
"max_back_track_time_days": 365,
59+
"exclude_merge_branches": [
60+
"Owner/qa"
61+
],
62+
"tag_resolver": {
63+
"method": "semver",
64+
"filter": {
65+
"pattern": "api-(.+)",
66+
"flags": "gu"
67+
}
68+
},
69+
"base_branches": [
70+
"dev"
71+
]
72+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Linux CI && Code Coverage
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
code-coverage:
14+
permissions:
15+
contents: write
16+
env:
17+
CARGO_INCREMENTAL: '0'
18+
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
19+
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Use nightly toolchain
25+
run: |
26+
rustup toolchain install nightly
27+
rustup override set nightly
28+
29+
- name: Caching cargo dependencies
30+
id: project-cache
31+
uses: Swatinem/rust-cache@v2
32+
33+
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
34+
name: Install grcov
35+
run: cargo install grcov
36+
37+
- name: Make the USER own the working directory
38+
if: ${{ matrix.os == 'ubuntu-latest' }}
39+
run: sudo chown -R $USER:$USER ${{ github.workspace }}
40+
41+
- name: Waking up docker
42+
run: docker-compose -f ./docker/docker-compose.yml up -d
43+
44+
- name: Run tests
45+
run: |
46+
cargo test --all-features --no-fail-fast --target=x86_64-unknown-linux-gnu -- --show-output --test-threads=1
47+
48+
- name: Waking up docker
49+
run: |
50+
docker-compose -f ./docker/docker-compose.yml down
51+
sudo chown -R $USER:$USER ${{ github.workspace }}
52+
rm -rf ./docker/postgres-data
53+
54+
- name: Generate code coverage report
55+
run: |
56+
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage
57+
grcov . -s . --binary-path ./target/debug/ -t cobertura --branch --ignore-not-existing -o ./target/debug/coverage/code_cov.xml
58+
59+
- name: Publish Test Results
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: Unit Test Results
63+
path: |
64+
./target/debug/coverage/code_cov.xml
65+
./target/debug/coverage/index.html
66+
67+
- name: Publish coverage report to GitHub Pages
68+
uses: JamesIves/github-pages-deploy-action@v4
69+
with:
70+
folder: ./target/debug/coverage
71+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)