Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
79 changes: 46 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ on:

jobs:
lint:
runs-on: self-hosted
runs-on: sia-autoscale-runners
strategy:
matrix:
node-version: [22]
node-version: [26]
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v6.1.0
with:
version: 12.15.0
- uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand All @@ -26,17 +29,20 @@ jobs:
- run: pnpm lint

build:
runs-on: self-hosted
runs-on: sia-autoscale-runners
strategy:
matrix:
node-version: [22]
node-version: [26]
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/checkout@v7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v6.1.0
with:
version: 12.15.0
- uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand All @@ -45,10 +51,10 @@ jobs:
- run: pnpm build

test:
runs-on: self-hosted
runs-on: sia-static-runners
strategy:
matrix:
node-version: [22]
node-version: [26]
env:
# Used for prisma generation
DATABASE_URL: mysql://test:test@localhost:3306/arena
Expand All @@ -66,21 +72,28 @@ jobs:
options: --name mariadb --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=30s --health-retries=5

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/checkout@v7

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node-version }}

- uses: pnpm/action-setup@v6.1.0
with:
version: 12.15.0

- uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- run: pnpm install --frozen-lockfile
- run: pnpm prisma generate
- run: pnpm prisma db push
- run: docker exec -i mariadb mysql -utest -ptest arena < seed.sql
- run: pnpm test:coverage
- uses: codecov/codecov-action@v5
- uses: codecov/codecov-action@v7
with:
fail_ci_if_error: true
verbose: true
Expand All @@ -89,21 +102,21 @@ jobs:

deploy-dbdocs:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
runs-on: sia-autoscale-runners
strategy:
matrix:
node-version: [22]
node-version: [26]
needs:
- lint
- build
- test
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6.1.0
with:
version: 9
version: 12.15.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v7.1.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand All @@ -116,23 +129,23 @@ jobs:

deploy:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
runs-on: self-hosted
runs-on: sia-static-runners
needs:
- lint
- build
- test
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Install docker
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4.4.1
- name: Login to registry
uses: docker/login-action@v3
uses: docker/login-action@v4.6.0
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7.4.0
with:
push: true
tags: |
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:22
FROM node:26

ENV NODE_ENV=production
WORKDIR /srv/app
Expand All @@ -10,7 +10,7 @@ RUN chown node:node .
USER node

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

RUN pnpm install --frozen-lockfile --production=false

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ua-api",
"description": "API web à destination des services de l'UTT Arena",
"packageManager": "pnpm@12.15.0",
"version": "1.0.0",
"private": false,
"license": "MIT",
Expand Down
158 changes: 158 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
allowBuilds:
'@prisma/client': true
'@prisma/engines': true
'@scarf/scarf': true
prisma: true
sharp: true
1 change: 1 addition & 0 deletions tests/utils/env.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';

describe('Test env', () => {
it('should load the environment variables of development environment', async () => {
Expand Down
Loading