Skip to content

style: dinero request and response objects now extend DineroObject #1182

style: dinero request and response objects now extend DineroObject

style: dinero request and response objects now extend DineroObject #1182

Workflow file for this run

name: Build & Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
actions: read
contents: read
pull-requests: write
statuses: read
jobs:
lint:
runs-on: ubuntu-latest
container:
image: node:18
steps:
- uses: actions/checkout@v3
- name: Cache and restore node_modules
id: cache-node
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ hashFiles('./package-lock.json') }}
- run: npm install
if: steps.cache-node.outputs.cache-hit != 'true'
- run: npm run lint
build:
needs: [ lint ]
runs-on: ubuntu-latest
container:
image: node:18
steps:
- uses: actions/checkout@v3
- name: Cache and restore node_modules
id: cache-node
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ hashFiles('./package-lock.json') }}
- run: npm install
if: steps.cache-node.outputs.cache-hit != 'true'
- run: npm run build
- name: "Compress out folder"
run: tar -zcvf out.tar.gz out/
- name: "Upload /out of build"
uses: actions/upload-artifact@v3
with:
name: build
path: out.tar.gz
retention-days: 1
coverage:
name: "coverage-${{ matrix.typeorm-connection }}"
needs: [ lint ]
runs-on: ubuntu-latest
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-synchronize: 'false'
- typeorm-connection: sqlite
typeorm-host: ''
typeorm-port: ''
typeorm-username: ''
typeorm-password: ''
typeorm-database: local.sqlite
typeorm-synchronize: 'true'
env:
NODE_ENV: development
API_HOST: localhost:3000
API_BASEPATH: /v1
CURRENCY_CODE: EUR
CURRENCY_PRECISION: 2
GEWISWEB_JWT_SECRET: ChangeMe
JWT_KEY_PATH: ./config/jwt.key
HTTP_PORT: 3000
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: ${{ matrix.typeorm-synchronize }}
TYPEORM_LOGGING: 0
LOG_LEVEL: INFO
RESET_TOKEN_EXPIRES: 3600
FILE_STORAGE_METHOD: disk
ENABLE_LDAP: true
PAGINATION_DEFAULT: 20
PAGINATION_MAX: 500
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_SUDOSOS_TEST_KEY }}
STRIPE_PRIVATE_KEY: ${{ secrets.STRIPE_SUDOSOS_TEST_KEY }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_TEST_SECRET }}
SKIP_SQLITE_DEFAULTS: true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache and restore node_modules
id: cache-node
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ hashFiles('./package-lock.json') }}
- 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: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: "Fetch target branch coverage from artifacts"
id: fetch-coverage-base
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && matrix.typeorm-connection == 'mariadb'
uses: dawidd6/action-download-artifact@v6
with:
workflow: build.yml
workflow_conclusion: success
name: coverage
if_no_artifact_found: warn
branch: ${{ github.base_ref }}
path: reports/coverage-base
- name: "Comment code coverage on PR"
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: reports/coverage-base/coverage-summary.json
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
path: reports/coverage/
retention-days: 7
post-migration-test:
runs-on: ubuntu-latest
env:
NODE_ENV: development
API_HOST: localhost:3000
API_BASEPATH: /v1
CURRENCY_CODE: EUR
CURRENCY_PRECISION: 2
GEWISWEB_JWT_SECRET: ChangeMe
JWT_KEY_PATH: ./config/jwt.key
HTTP_PORT: 3000
TYPEORM_CONNECTION: mariadb
TYPEORM_HOST: mariadb
TYPEORM_PORT: 3306
TYPEORM_USERNAME: sudosos-ci
TYPEORM_PASSWORD: sudosos-ci
TYPEORM_DATABASE: sudosos-ci
TYPEORM_SYNCHRONIZE: 'false'
TYPEORM_LOGGING: 0
LOG_LEVEL: INFO
RESET_TOKEN_EXPIRES: 3600
FILE_STORAGE_METHOD: disk
ENABLE_LDAP: true
PAGINATION_DEFAULT: 20
PAGINATION_MAX: 500
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_SUDOSOS_TEST_KEY }}
STRIPE_PRIVATE_KEY: ${{ secrets.STRIPE_SUDOSOS_TEST_KEY }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_TEST_SECRET }}
SKIP_SQLITE_DEFAULTS: true
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
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache and restore node_modules
id: cache-node
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ hashFiles('./package-lock.json') }}
- 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:validate
- run: npm run test-ci-migrate