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

gorm compilable queries #62

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dc408d6
update mockery version
FrancoLiberali Jul 27, 2023
e2c0776
fix typos in Authentication, resource and constructor
FrancoLiberali Jul 27, 2023
83e1446
fix route for auth unit tests
FrancoLiberali Jul 27, 2023
33e371c
remove error that is always nil
FrancoLiberali Jul 27, 2023
03c876c
add TODO to the changes to be done in the session service
FrancoLiberali Jul 27, 2023
960f598
add error management to middlewareJSON
FrancoLiberali Jul 27, 2023
1f7761f
add CommandInitializer to init configuration keys
FrancoLiberali Jul 27, 2023
28e3ecb
init database configuration keys
FrancoLiberali Jul 27, 2023
63de335
init session configuration keys
FrancoLiberali Jul 27, 2023
807e598
init initialization configuration keys
FrancoLiberali Jul 27, 2023
2de14ef
init server configuration keys
FrancoLiberali Jul 27, 2023
2dc5907
init logger configuration keys
FrancoLiberali Jul 27, 2023
cbb6f5c
remove unused r.md file in commands
FrancoLiberali Jul 27, 2023
d165eec
move time to utils
FrancoLiberali Jul 27, 2023
b80f2e4
create super user when adding the auth controller
FrancoLiberali Jul 27, 2023
88db618
update info controller and routes creation
FrancoLiberali Jul 27, 2023
1730a33
change the way badaas server is created
FrancoLiberali Jul 27, 2023
25f8e57
move test e2e to test_e2e/ and docker to docker/
FrancoLiberali Jul 28, 2023
f1bed03
do not run auto migration on test e2e execution + automigration refactor
FrancoLiberali Jul 28, 2023
f523952
update docs and developers utils
FrancoLiberali Jul 27, 2023
227c9c2
remove unnecesary init.sh for cockroach and add health check
FrancoLiberali Jul 31, 2023
e51325e
move db connection to orm module and make automigration possible by fx
FrancoLiberali Jul 31, 2023
ff2318e
info and auth modules now also provide the corresponding services and…
FrancoLiberali Jul 31, 2023
8ccf49c
use gotestsum to run tests + create tests report + tool to install de…
FrancoLiberali Jul 31, 2023
e3da4cc
add base models to orm
FrancoLiberali Jul 31, 2023
d12b69e
add crud services and repositories in orm module
FrancoLiberali Jul 31, 2023
e61ac47
adapt existing services and controllers to use orm module
FrancoLiberali Jul 31, 2023
ef381b2
add integration tests
FrancoLiberali Jul 31, 2023
319dd73
update documentation
FrancoLiberali Jul 31, 2023
a9c3ead
update changelog
FrancoLiberali Jul 31, 2023
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
21 changes: 12 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
.editorconfig
.git
.gitignore
.github
sonar-project.properties
AUTHORS.md
CONTRIBUTING.md
*.md
LICENSE
Makefile
NOTICE
README.md
arm/
powerpc/
mips/
.golangci.yml
_temp
.vscode
node1
node2
node3
.gitignore
changelog.md
go.work
go.work.sum
tools/
test_e2e/
!test_e2e/test_api.go
!test_e2e/go.mod
!test_e2e/go.sum
mocks/
docker/
**/*_test.go
15 changes: 9 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,33 @@ title: ''
labels: Bug
---

**Describe the bug**
## Describe the bug

A clear and concise description of what the bug is.

**To Reproduce**
## To Reproduce

Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
## Expected behavior

A clear and concise description of what you expected to happen.

**Screenshots**
## Screenshots

If applicable, add screenshots to help explain your problem.

**Application (please complete the following information):**
## Application

Please complete the following information:

- badaas version [X.X.X] or commit hash

**Additional context**
## Additional context

Add any other context about the problem here.
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/user_story.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ labels: User Story, To be verify

`[Put all others constraints here, like list of acceptances values or other]`

## Resources:
## Resources

`[Put all your resources here, like mockups, diagrams or other here]`

Expand All @@ -37,4 +37,3 @@ labels: User Story, To be verify
## Links

`[Only use by the team, to link this feature with epic, technical tasks or bugs]`

4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:information_source: Don't forget to modify the changelog.md before merging this branch.

:information_source: Don't forget to modify config files:
- `badaas.example.yml`: the example file.
- `/scripts/e2e/api/ci-conf.yml`: otherwise you will probably break the CI. (*For local testing please use [act](https://github.com/nektos/act)*).

- `badaas.example.yml`: the example file.
97 changes: 71 additions & 26 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
branch-naming-rules:
name: Check branch name
Expand All @@ -18,6 +19,26 @@ jobs:
min_length: 5
max_length: 50

check-style:
name: Code style
needs: [branch-naming-rules]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: '^1.18'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true

unit-tests:
name: Unit tests
needs: [branch-naming-rules]
Expand All @@ -30,16 +51,25 @@ jobs:
with:
go-version: '^1.18'
cache: true
- name: Run test
run: go test $(go list ./... | sed 1d) -coverprofile=coverage.out -v
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Run unit tests
run: gotestsum --junitfile unit-tests.xml $(go list ./... | grep -v testintegration) -coverpkg=./... -coverprofile=coverage_unit.out
- uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.out
name: coverage_unit
path: coverage_unit.out
- name: Test Report
uses: dorny/test-reporter@v1
if: always() # run this step even if previous steps failed
with:
name: Unit Tests Report # Name of the check run which will be created
path: unit-tests.xml # Path to test results
reporter: java-junit # Format of test results

check-style:
name: Code style
needs: [branch-naming-rules]
integration-tests:
name: Integration tests
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -49,14 +79,25 @@ jobs:
with:
go-version: '^1.18'
cache: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Start containers
run: docker compose -f "docker/test_db/docker-compose.yml" up -d
- name: Run test
run: gotestsum --junitfile integration-tests.xml ./testintegration -coverpkg=./... -coverprofile=coverage_int.out
- name: Test Report
uses: dorny/test-reporter@v1
if: always() # run this step even if previous steps failed
with:
version: latest
skip-cache: true
skip-pkg-cache: true
skip-build-cache: true
name: Integration Tests Report # Name of the check run which will be created
path: integration-tests.xml # Path to test results
reporter: java-junit # Format of test results
- uses: actions/upload-artifact@v3
with:
name: coverage_int
path: coverage_int.out
- name: Stop containers
run: docker stop badaas-test-db

e2e-tests:
name: E2E Tests
Expand All @@ -71,41 +112,45 @@ jobs:
go-version: '^1.18'
cache: true
- name: Start containers
run: docker compose -f "scripts/e2e/docker-compose.yml" up -d --build
run: docker compose -f "docker/test_db/docker-compose.yml" -f "docker/test_api/docker-compose.yml" up -d --build
- name: Wait for API server to be up
uses: mydea/action-wait-for-api@v1
with:
url: "http://localhost:8000/info"
timeout: 20
timeout: 60
- name: Run test
run: go test -v
run: go test ./test_e2e -v
- name: Get logs
if: always()
run: docker compose -f "scripts/e2e/docker-compose.yml" logs --no-color 2>&1 | tee app.log &
run: docker compose -f "docker/test_db/docker-compose.yml" -f "docker/test_api/docker-compose.yml" logs --no-color 2>&1 | tee app.log &
- name: Stop containers
if: always()
run: docker compose -f "scripts/e2e/docker-compose.yml" down
run: docker compose -f "docker/test_db/docker-compose.yml" -f "docker/test_api/docker-compose.yml" down
- uses: actions/upload-artifact@v3
with:
name: docker-compose-e2e-logs
path: app.log

sonarcloud:
name: SonarCloud
needs: [unit-tests, check-style]
needs: [check-style, integration-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download line coverage report
- name: Download unit tests line coverage report
uses: actions/download-artifact@v3
with:
name: coverage
path: coverage.out
name: coverage_unit
path: coverage_unit.out
- name: Download int tests line coverage report
uses: actions/download-artifact@v3
with:
name: coverage_int
path: coverage_int.out
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/

# Go workspace file
go.work
# go.work

# cockroach files
node*

#Vscode conf
# vscode conf
.vscode

# binary output
badaas

# temporary directories
_temp
badaas
Loading