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

Fixed bug in swagger spec for the fines eligible #118

Closed
wants to merge 13 commits into from
Closed
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
49 changes: 42 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,34 @@ jobs:
retention-days: 1

coverage:
needs: [lint]
name: "coverage-${{ matrix.typeorm-connection }}"
needs: [ lint ]
runs-on: [ self-hosted, linux, docker ]
container:
image: node:18
services:
mariadb:
image: mariadb:lts
env:
MARIADB_RANDOM_ROOT_PASSWORD: true
MARIADB_DATABASE: sudosos-ci
MARIADB_USER: sudosos-ci
MARIADB_PASSWORD: sudosos-ci
strategy:
matrix:
include:
- typeorm-connection: mariadb
typeorm-host: mariadb
typeorm-port: 3306
typeorm-username: sudosos-ci
typeorm-password: sudosos-ci
typeorm-database: sudosos-ci
- typeorm-connection: sqlite
typeorm-host: ''
typeorm-port: ''
typeorm-username: ''
typeorm-password: ''
typeorm-database: local.sqlite
env:
NODE_ENV: development
API_HOST: localhost:3000
Expand All @@ -71,10 +95,14 @@ jobs:
GEWISWEB_JWT_SECRET: ChangeMe
JWT_KEY_PATH: ./config/jwt.key
HTTP_PORT: 3000
TYPEORM_CONNECTION: sqlite
TYPEORM_DATABASE: local.sqlite
TYPEORM_CONNECTION: ${{ matrix.typeorm-connection }}
TYPEORM_HOST: ${{ matrix.typeorm-host }}
TYPEORM_PORT: ${{ matrix.typeorm-port }}
TYPEORM_USERNAME: ${{ matrix.typeorm-username }}
TYPEORM_PASSWORD: ${{ matrix.typeorm-password }}
TYPEORM_DATABASE: ${{ matrix.typeorm-database }}
TYPEORM_SYNCHRONIZE: 0
TYPEORM_LOGGING: 1
TYPEORM_LOGGING: 0
LOG_LEVEL: INFO
RESET_TOKEN_EXPIRES: 3600
FILE_STORAGE_METHOD: disk
Expand All @@ -94,18 +122,25 @@ jobs:
- run: npm install
if: steps.cache-node.outputs.cache-hit != 'true'
- run: openssl genrsa -out ./config/jwt.key 2048 && chmod 0777 ./config/jwt.key
- run: npm run swagger
- run: npm run coverage
- run: npm run swagger:validate
- run: npm run coverage-ci # Separate command to limit the number of workers to prevent timeouts
- run: git config --global --add safe.directory $GITHUB_WORKSPACE # To avoid dubious ownership
if: ${{ matrix.typeorm-connection == 'mariadb' }}

- name: "Cannot commit code coverage cross-fork"
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork && matrix.typeorm-connection == 'mariadb'
run: |
echo "::warning Cannot comment code coverage cross-fork"
- name: "Comment code coverage on PR"
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && matrix.typeorm-connection == 'mariadb'
uses: sidx1024/[email protected]
with:
comment_template_file: .github/coverage-template.md
coverage_file: reports/coverage/coverage-summary.json
base_coverage_file: ''
sources_base_path: "/__w/sudosos-backend/sudosos-backend" #github.action_path does not work in Docker (https://github.com/actions/runner/issues/716)
- name: "Upload code coverage report"
if: ${{ matrix.typeorm-connection == 'mariadb' }}
uses: actions/upload-artifact@v3
with:
name: coverage
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker Build

on:
pull_request:
branches: [ main, develop ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
dockerize:
runs-on: [self-hosted, linux, docker]
container:
image: docker:dind
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get Docker meta across forks
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ github.actor }}/${{ github.repository }}
tags: |
type=ref,event=pr

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

# Build and push Docker image with Buildx (don't push on PR)
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64 #SudoSOS does not run on linux/arm64
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Docker
name: Docker Build & Push

on:
push:
branches: [ main, develop ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main, develop ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -55,7 +53,7 @@ jobs:
with:
context: .
platforms: linux/amd64 #SudoSOS does not run on linux/arm64
push: ${{ github.event_name != 'pull_request' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down
97 changes: 0 additions & 97 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .run/Template Mocha.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<working-directory />
<pass-parent-env>true</pass-parent-env>
<ui />
<extra-mocha-options>-r ts-node/register --timeout 50000 --file ./test/setup.ts --reporter mocha-multi-reporters --reporter-options configFile=mocha.json</extra-mocha-options>
<extra-mocha-options>-r ts-node/register --timeout 50000 --require ./test/setup.ts --reporter mocha-multi-reporters --reporter-options configFile=mocha.json</extra-mocha-options>
<test-kind>DIRECTORY</test-kind>
<test-directory />
<recursive>false</recursive>
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ RUN apk add openssl
WORKDIR /app
COPY ./package.json ./package-lock.json ./
RUN npm ci
RUN npm install pm2 -g
RUN npm install pm2 pm2-graceful-intercom -g
ARG TYPEORM_USERNAME
ARG TYPEORM_PASSWORD
ARG TYPEORM_DATABASE

COPY --from=build --chown=node /app/init_scripts /app/init_scripts
COPY --from=build --chown=node /app/process.json /app/process.json
COPY --from=build --chown=node /app/pm2.json /app/pm2.json
RUN chmod +x /app/init_scripts/start.sh

COPY --from=build --chown=node /app/out/src /app/out/src
Expand Down
2 changes: 1 addition & 1 deletion init_scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ chmod +x /app/init_scripts/00_make_sudosos_data_dirs.sh
chmod +x /app/init_scripts/00_regen_sudosos_secrets.sh
sh /app/init_scripts/00_make_sudosos_data_dirs.sh
sh /app/init_scripts/00_regen_sudosos_secrets.sh
pm2-runtime start /app/process.json
pm2-runtime start /app/pm2.json
7 changes: 2 additions & 5 deletions mocha.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"reporterEnabled": "spec, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "reports/junit.xml"
}
}
"reporterEnabled": "spec"
}
Loading
Loading