Skip to content

Commit

Permalink
Merge pull request #147 from ungdev/dev
Browse files Browse the repository at this point in the history
Landing website for 2023
  • Loading branch information
TeddyRoncin authored Oct 5, 2023
2 parents 43f7e33 + 0e09656 commit 1603a37
Show file tree
Hide file tree
Showing 117 changed files with 10,736 additions and 8,789 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/build
.nyc_output
coverage
yarn-error.log
pnpm-error.log

# misc
.DS_Store
Expand Down
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ API_PORT=3000
# Define API URL prefix
API_PREFIX=/

# Define the Bearer token used to upload files
UPLOAD_FILE_TOKEN=1234azer

# JsonWebToken configuration
JWT_SECRET=someRandomString64Bytes
JWT_EXPIRES=7 days
Expand Down
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Nom de la PR

## Changements

## Breaking changes

## Ce qu'il reste à faire (POUR LES DRAFTS)

- [ ] Vérifier le build
- [ ] Lint
- [ ] Supprimer les console.log / code commenté
78 changes: 53 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,47 @@ on:
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn prisma generate
- run: yarn lint
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm pnpx prisma generate
- run: pnpm lint

build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn prisma generate
- run: yarn build
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm pnpx prisma generate
- run: pnpm build

test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
env:
# Used for prisma generation
DATABASE_URL: mysql://test:test@localhost:3306/arena
Expand All @@ -50,36 +67,47 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn prisma generate
- run: yarn prisma db push
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm pnpx prisma generate
- run: pnpm pnpx prisma db push
- run: docker exec -i mariadb mysql -utest -ptest arena < seed.sql
- run: yarn test:coverage
- run: pnpm test:coverage
- uses: codecov/codecov-action@v1

deploy-dbdocs:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
needs:
- lint
- build
- test
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn prisma generate
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm pnpx prisma generate
- env:
BRANCH: ${{ github.ref == 'refs/heads/master' && 'master' || 'dev' }}
DBDOCS_TOKEN: ${{ secrets.DBDOCS_TOKEN }}
run: yarn dbdocs build dbml/schema.dbml --project=${{ env.BRANCH }}
run: pnpm dbdocs build dbml/schema.dbml --project=${{ env.BRANCH }}

deploy:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/build
.nyc_output
coverage
yarn-error.log
pnpm-error.log

# misc
.DS_Store
Expand All @@ -22,6 +22,4 @@ yarn-error.log

openapi.json

/docs/build

compumsaCodes.json
/docs/build
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
FROM node:16
FROM node:18

ENV NODE_ENV=production
WORKDIR /srv/app

RUN npm install -g pnpm

RUN chown node:node .

USER node

# Node has the uid 1000
COPY --chown=node:node package.json yarn.lock schema.prisma ./
COPY --chown=node:node package.json pnpm-lock.yaml schema.prisma ./

RUN yarn --frozen-lockfile --production=false --network-timeout 1000000
RUN pnpm install --frozen-lockfile --production=false

COPY --chown=node:node ./ ./

RUN yarn prisma generate
RUN yarn build
RUN pnpm pnpx prisma generate
RUN pnpm build

# Prunes devDependencies
RUN yarn install --production --ignore-scripts --prefer-offline --network-timeout 1000000
RUN pnpm install --production --ignore-scripts --prefer-offline

CMD yarn start
CMD pnpm start
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ API web à destination des services de l'UTT Arena
## Requirements

- [Node.js](https://nodejs.org/)
- [yarn](https://yarnpkg.com/)
- [pnpm](https://pnpm.io/)

## Installation

Expand All @@ -23,7 +23,7 @@ git clone https://github.com/ungdev/UA-api.git
cd UA-api
# Install all the dependencies
yarn
pnpm install
# Copy the file .env.example to .env
Expand All @@ -41,7 +41,7 @@ CREATE DATABASE arena CHARACTER SET utf8;
Create the tables

```
yarn prisma db push
pnpm prisma db push
```

Populate the tables
Expand All @@ -53,7 +53,7 @@ mysql -u DATABASE_USER -p arena --protocol tcp < seed.sql
Generate the prisma client (redo this command when you update schema.prisma)

```
yarn prisma generate
pnpm prisma generate
```

## Configuration
Expand All @@ -63,12 +63,12 @@ Edit the file .env with your values
## Commands

```
yarn dev # start development server
yarn build # builds the typescript to javascript
yarn start # start production server
yarn lint # checks if the code is correct
yarn lint-fix # try to fix lint errors and warnings
yarn fake # populate the database with fake data
pnpm dev # start development server
pnpm build # builds the typescript to javascript
pnpm start # start production server
pnpm lint # checks if the code is correct
pnpm lint-fix # try to fix lint errors and warnings
pnpm fake # populate the database with fake data
```

## Prisma config
Expand Down
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

65 changes: 0 additions & 65 deletions docs/conf.py

This file was deleted.

Loading

0 comments on commit 1603a37

Please sign in to comment.