You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rails API Base is a boilerplate project for JSON RESTful APIs. It follows the community best practices in terms of standards, security and maintainability, integrating a variety of testing and code quality tools. It's based on Rails 8.0 and Ruby 3.4.
8
8
@@ -134,6 +134,26 @@ With `bundle exec rails code:analysis` you can run the code analysis tool, you c
134
134
-[Rails Best Practices](https://github.com/flyerhzm/rails_best_practices#custom-configuration) Edit `config/rails_best_practices.yml`
135
135
-[Brakeman](https://github.com/presidentbeef/brakeman) Run `brakeman -I` to generate `config/brakeman.ignore`
136
136
137
+
## Code quality and test coverage
138
+
139
+
The project uses SonarQube Community Edition to ensure code quality and monitor test coverage. The configuration can be found in `sonar-project.properties`.
140
+
141
+
To set up SonarQube:
142
+
143
+
1. Install SonarQube locally (see [CI documentation](docs/ci.md#setting-up-sonarqube) for details)
144
+
2. Configure your environment variables:
145
+
```bash
146
+
export SONAR_TOKEN=your_token
147
+
export SONAR_HOST_URL=http://localhost:9000
148
+
```
149
+
3. Run the analysis:
150
+
```bash
151
+
bundle exec rspec
152
+
sonar-scanner
153
+
```
154
+
155
+
For more details about the CI process and SonarQube setup, check the [CI documentation](docs/ci.md).
156
+
137
157
## More linters
138
158
-[Hadolint](https://github.com/hadolint/hadolint) Install with `brew install hadolint` and run `hadolint Dockerfile*`. Edit `.hadolint.yml` to omit additional rules.
139
159
@@ -148,12 +168,6 @@ See [Impersonation docs](./docs/impersonation.md) for more info
148
168
In order to use [New Relic](https://newrelic.com) to monitor your application requests and metrics, you must setup `NEW_RELIC_API_KEY` and `NEW_RELIC_APP_NAME` environment variables.
149
169
To obtain an API key you must create an account in the platform.
150
170
151
-
## Configuring Code Climate
152
-
153
-
1. After adding the project to CC, go to `Repo Settings`
154
-
1. On the `Test Coverage` tab, copy the `Test Reporter ID`
155
-
1. Set the current value of `CC_TEST_REPORTER_ID` in the [GitHub secrets and variables](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository)
156
-
157
171
## Code Owners
158
172
159
173
You can use [CODEOWNERS](https://help.github.com/en/articles/about-code-owners) file to define individuals or teams that are responsible for code in the repository.
Copy file name to clipboardExpand all lines: docs/ci.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,31 @@
1
-
# CI
1
+
# Continuous Integration
2
+
3
+
This project uses GitHub Actions for continuous integration. The workflow is defined in `.github/workflows/ci.yml`.
4
+
5
+
## What's being tested and analyzed?
6
+
7
+
The CI process includes:
8
+
1. Running all RSpec tests
9
+
2. Running code style checks via RuboCop
10
+
3. Running security checks via Brakeman
11
+
4. Running best practices checks via Rails Best Practices
12
+
5. Running code quality and test coverage analysis via SonarQube
13
+
6. Checking for missing annotations
14
+
7. Linting Dockerfiles
15
+
8. Building Docker images
16
+
9. Generating and updating API documentation
17
+
18
+
## CI Setup Requirements
19
+
20
+
### SonarQube Configuration
21
+
Configure these secrets in your GitHub repository (Settings → Secrets and variables → Actions):
22
+
-`SONAR_TOKEN`: Your SonarQube token
23
+
-`SONAR_HOST_URL`: Your SonarQube server URL
24
+
25
+
The CI will automatically run tests, generate coverage reports, and upload results to SonarQube.
2
26
3
27
## Parallelization with Parallel Tests & Knapsack
28
+
4
29
Knapsack and Parallel Tests gems allow us to run tests in several nodes at the same time, benefiting us in the execution time. Knapsack parallelizes them at node level while Parallel Tests does it at CPU level.
5
30
6
31
Knapsack splits tests based on an execution time report. In case there are files that were not added in the report, they will all run on the same node and may overload it, so it is strongly recommended to update the report frequently.
0 commit comments