Skip to content

Commit 940dd2d

Browse files
Merge pull request #90 from NIAEFEUP/chore/update-docs-and-ci
chore: updated docs and ci
2 parents 006a18f + 9701f4e commit 940dd2d

File tree

5 files changed

+87
-74
lines changed

5 files changed

+87
-74
lines changed
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
name: CI
1+
name: Pull Request Checks
22

33
on:
44
push:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
lint-and-format:
14+
name: Lint and Format
1115
runs-on: ubuntu-latest
1216
strategy:
1317
matrix:
@@ -22,6 +26,7 @@ jobs:
2226
run: biome ci ./src ./test
2327

2428
test:
29+
name: Test and Collect Coverage
2530
runs-on: ubuntu-latest
2631
needs: [lint-and-format]
2732
strategy:
@@ -36,10 +41,15 @@ jobs:
3641
cache: 'npm'
3742
- name: Install Dependencies
3843
run: npm ci
39-
- name: Unit Tests
40-
run: npm test
44+
- name: Run Tests and Collect Coverage
45+
run: npm run test:cov
46+
- name: Upload Coverage to Codecov
47+
uses: codecov/codecov-action@v5
48+
with:
49+
token: ${{ secrets.CODECOV_TOKEN }}
4150

4251
build:
52+
name: Build
4353
runs-on: ubuntu-latest
4454
needs: [lint-and-format]
4555
strategy:

.github/workflows/coverage.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ ENV NODE_ENV=production
2424

2525
# Install only prod deps
2626
COPY package*.json ./
27-
COPY .env.docker .env
2827
RUN npm ci --omit=dev && npm cache clean --force
2928

3029
# Copy built artifacts

README.md

Lines changed: 73 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
# NIddle
22

33
<p align="center">
4-
<a href="https://github.com/niaefeup/niddle/actions/workflows/ci.yml">
5-
<img alt="CI" src="https://img.shields.io/github/actions/workflow/status/niaefeup/niddle/ci.yml?branch=main">
6-
</a>
7-
<a href="https://codecov.io/gh/NIAEFEUP/NIddle" >
8-
<img src="https://codecov.io/gh/NIAEFEUP/NIddle/graph/badge.svg?token=GLE6F6JWZK"/>
9-
</a>
10-
<a href="https://github.com/biomejs/biome/">
11-
<img alt="code style: biome" src="https://img.shields.io/badge/code_style-biome-ff69b4.svg?style=flat-square">
12-
</a>
13-
<a href="https://github.com/niaefeup/niddle/graphs/contributors">
14-
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/niaefeup/niddle">
15-
</a>
16-
<a href="https://github.com/niaefeup/niddle/issues">
17-
<img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/niaefeup/niddle">
18-
</a>
19-
<a href="https://github.com/niaefeup/niddle/blob/main/LICENSE">
20-
<img alt="GitHub License" src="https://img.shields.io/github/license/niaefeup/niddle">
21-
</a>
4+
<a href="https://github.com/niaefeup/niddle/actions/workflows/checks.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/niaefeup/niddle/checks.yml?branch=main"></a>
5+
<a href="https://codecov.io/gh/NIAEFEUP/NIddle" ><img src="https://codecov.io/gh/NIAEFEUP/NIddle/graph/badge.svg?token=GLE6F6JWZK"/></a>
6+
<a href="https://github.com/biomejs/biome/"><img alt="code style: biome" src="https://img.shields.io/badge/code_style-biome-ff69b4.svg?style=flat-square"></a>
7+
<a href="https://github.com/niaefeup/niddle/graphs/contributors"><img alt="GitHub contributors" src="https://img.shields.io/github/contributors/niaefeup/niddle"></a>
8+
<a href="https://github.com/niaefeup/niddle/issues"><img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/niaefeup/niddle"></a>
9+
<a href="https://github.com/niaefeup/niddle/blob/main/LICENSE"><img alt="GitHub License" src="https://img.shields.io/github/license/niaefeup/niddle"></a>
2210
</p>
2311

2412
## Overview
2513

26-
NIddle is a middleware service that acts as an interface between the official University of Porto website (Sigarra) and the UNI mobile application. The primary goal of NIddle is to provide a stable, modern, and reliable API for the UNI app, abstracting away the complexities of the Sigarra website.
14+
NIddle is a service dedicated to managing and providing static data for the UNI mobile application. It serves as a central hub for university-related information such as faculty and course events, academic services, and student association content.
2715

28-
This approach allows for a more agile development process for the UNI mobile app, as changes in Sigarra can be handled by NIddle without requiring a new release of the mobile app. Additionally, NIddle introduces custom functionalities not available in Sigarra, such as a custom announcement system.
16+
The primary goal of NIddle is to provide a reliable and easily maintainable API for the UNI app, ensuring that static resources are kept up-to-date and accessible without the need for frequent application releases.
2917

3018
## Features
3119

32-
- **Stable API**: Provides a consistent API for schedules, exams, and other university data, protecting the mobile app from changes in the underlying source.
33-
- **Decoupled Architecture**: Separates the mobile app from the university's web services, allowing for independent development and deployment cycles.
34-
- **Extensible**: Easily add new features and endpoints to support the mobile app.
35-
- **Custom Functionalities**: Includes additional features not present in Sigarra, such as a dedicated announcement system.
20+
- **Stable API**: Provides a consistent and reliable API for faculty events, course information, and student association data.
21+
- **Modern Tech Stack**: Built with [NestJS](https://nestjs.com/), [TypeORM](https://typeorm.io/), and [PostgreSQL](https://www.postgresql.org/).
22+
- **API Documentation**: Interactive documentation powered by [Swagger](https://swagger.io/).
23+
- **Database Management**: Easy schema management and data seeding for development.
24+
- **Typescript First**: Fully typed API for better developer experience and reliability.
25+
- **CI/CD Ready**: Automated testing and linting with GitHub Actions.
26+
- **Containerized**: Support for Docker and Nix for consistent environments.
27+
28+
## API Documentation
29+
30+
NIddle comes with built-in API documentation using Swagger. Once the application is running, you can access the documentation at:
31+
32+
```
33+
http://localhost:3000/docs
34+
```
35+
36+
This provides an interactive interface to explore and test the available endpoints.
3637

3738
## Getting Started
3839

@@ -77,20 +78,48 @@ These instructions will get you a copy of the project up and running on your loc
7778
npm install
7879
```
7980

80-
5. **Run the application**
81+
5. **Seed the database (Optional)**
82+
83+
If you want to populate the database with some initial data:
84+
85+
```bash
86+
npm run seed
87+
```
88+
89+
6. **Run the application**
8190

8291
```bash
8392
npm run start:dev
8493
```
8594

8695
The application will be running in watch mode at `http://localhost:3000`.
8796

97+
## Nix Support
98+
99+
If you use [Nix](https://nixos.org/), this project includes a flake that provides a development shell with all the necessary tools (Node.js 22, Nest CLI, etc.).
100+
101+
```bash
102+
nix develop
103+
```
104+
105+
This ensures a consistent development environment across different machines.
106+
88107
## Docker
89108

90109
NIddle is fully containerized and can be easily built and run as a Docker image.
91110

92111
### Building the Image
93112

113+
- **Run the build script**
114+
115+
The `build_image.sh` script will build the Docker image for you.
116+
117+
```bash
118+
./build_image.sh
119+
```
120+
121+
### Running the Image
122+
94123
1. **Set up Docker environment variables**
95124

96125
Copy the example environment file to `.env.docker`.
@@ -101,32 +130,36 @@ NIddle is fully containerized and can be easily built and run as a Docker image.
101130

102131
Open `.env.docker` and configure the variables for the Docker environment.
103132

104-
2. **Run the build script**
133+
2. **Run the run script**
105134

106-
The `build_image.sh` script will build the Docker image for you.
135+
The `run_image.sh` script will start a container from the image and inject the environment variables from `.env.docker`.
107136

108137
```bash
109-
./build_image.sh
138+
./run_image.sh
110139
```
111140

112-
### Running the Image
141+
## Available Scripts
113142

114-
- **Run the run script**
143+
### Development & Build
115144

116-
The `run_image.sh` script will start a container from the image you just built.
145+
- `npm run build`: Compiles the project to the `dist` folder.
146+
- `npm run start`: Starts the application.
147+
- `npm run start:dev`: Starts the application in development mode with watch mode.
148+
- `npm run start:prod`: Starts the application from the compiled production build.
149+
- `npm run seed`: Seeds the database with sample data.
117150

118-
```bash
119-
./run_image.sh
120-
```
151+
### Quality & Linting
121152

122-
## Available Scripts
153+
- `npm run check`: Runs both linting and formatting checks.
154+
- `npm run check:fix`: Automatically fixes linting and formatting issues.
155+
- `npm run lint`: Lints the codebase using Biome.
156+
- `npm run format`: Formats the codebase using Biome.
157+
158+
### Testing
123159

124-
- `npm run build`: Compiles the project.
125-
- `npm run format`: Formats the code using Biome.
126-
- `npm run start:prod`: Starts the application in production mode.
127-
- `npm run start:dev`: Starts the application in development mode with watch.
128-
- `npm run lint`: Lints the codebase.
129160
- `npm test`: Runs unit tests.
161+
- `npm run test:watch`: Runs unit tests in watch mode.
162+
- `npm run test:cov`: Runs unit tests and generates coverage reports.
130163
- `npm run test:e2e`: Runs end-to-end tests.
131164

132165
## License

run_image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ echo "🚀 Starting container $CONTAINER_NAME on network $NETWORK_NAME ..."
1616
docker run --rm -it \
1717
--name "$CONTAINER_NAME" \
1818
--network "$NETWORK_NAME" \
19+
--env-file .env.docker \
1920
-p 3000:3000 \
2021
"$IMAGE_NAME"

0 commit comments

Comments
 (0)