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

Backend infrastructure #65

Merged
merged 12 commits into from
Feb 16, 2022
110 changes: 110 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Backend Test suite

on:
push:
branches:
- master
- develop
pull_request:

jobs:
lintcode:
name: Javascript lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: setup node
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- run: cd backend && npm install
- run: cd backend && npm run lint:code

tests:
name: Meteor ${{ matrix.meteor }} tests
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

# CACHING
- name: Install Meteor
id: cache-meteor-install
uses: actions/cache@v2
with:
path: ~/.meteor
key: v1-meteor-${{ hashFiles('.meteor/versions') }}
restore-keys: |
v1-meteor-

- name: Cache NPM dependencies
id: cache-meteor-npm
uses: actions/cache@v2
with:
path: ~/.npm
key: v1-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
v1-npm-

- name: Cache Meteor build
id: cache-meteor-build
uses: actions/cache@v2
with:
path: |
.meteor/local/resolver-result-cache.json
.meteor/local/plugin-cache
.meteor/local/isopacks
.meteor/local/bundler-cache/scanner
key: v1-meteor_build_cache-${{ github.ref }}-${{ github.sha }}
restore-key: |
v1-meteor_build_cache-

- name: Setup meteor
uses: meteorengineer/setup-meteor@v1
with:
meteor-release: '2.5'

- name: Install NPM Dependencies
run: cd backend && meteor npm ci

- name: Run Tests
run: cd backend && sh ./test.sh -c -o

# TODO add coverage checks etc.
# - name: Upload coverage
# uses: actions/upload-artifact@v2
# with:
# name: coverage-folder
# path: backend/.coverage/
#
# coverage:
# name: Coverage report
# runs-on: ubuntu-latest
# needs: [tests]
# steps:
# - name: Checkout
# uses: actions/checkout@v2
#
# - name: Download coverage
# uses: actions/download-artifact@v2
# with:
# name: coverage-folder
# path: backend/.coverage/
#
#
# - name: Coverage Report
# uses: VeryGoodOpenSource/very_good_coverage@v1.1.1
# with:
# path: ".coverage/lcov.info"
# min_coverage: 95 # TODO increase to 95!
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $ meteor npm run start
We use jest (as default, defined by expo) to run the app tests and mocha to run
the backend tests.

To tun the tests on the backend, please execute the `meteor npm run test` script in the
To tun the tests on the backend, please execute the `./test.sh` script in the
`backend` project folder.

To run the tests for the app, please execute `meteor npm run test` in the app's `src`
Expand Down
126 changes: 125 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,125 @@
node_modules/
# folders
node_modules/
packages/

# ide specific
.idea
.vscode

# config files
productionSettings.json
leaconfig.json
i18n_routes.json
routes.json

# proprietary stuff
public/fonts/
public/logos/

.deploy

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
.coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
22 changes: 21 additions & 1 deletion backend/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,25 @@ ecmascript@0.16.1 # Enable ECMAScript2015+ syntax in app code
typescript@4.4.1 # Enable TypeScript syntax in .ts and .tsx modules
# shell-server@0.5.0 # Server-side component of the `meteor shell` command

#========================================
# TESTING
#========================================
meteortesting:mocha
lmieulet:meteor-coverage@3.2.0

accounts-password
random
random
logging

aldeed:collection2
dburles:mongo-collection-instances
leaonline:method-factory
leaonline:publication-factory
leaonline:ratelimit-factory

#========================================
# SECURITY
#========================================
audit-argument-checks@1.0.7
force-ssl@1.1.0

17 changes: 17 additions & 0 deletions backend/.meteor/versions
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
accounts-base@2.2.0
accounts-password@2.2.0
aldeed:collection2@3.5.0
allow-deny@1.1.0
audit-argument-checks@1.0.7
autoupdate@1.8.0
babel-compiler@7.8.0
babel-runtime@1.5.0
Expand All @@ -12,6 +14,7 @@ caching-compiler@1.2.2
caching-html-compiler@1.2.1
callback-hook@1.4.0
check@1.3.1
dburles:mongo-collection-instances@0.3.5
ddp@1.4.0
ddp-client@2.5.0
ddp-common@1.4.0
Expand All @@ -27,16 +30,28 @@ ejson@1.1.1
email@2.2.0
es5-shim@4.8.0
fetch@0.1.1
force-ssl@1.1.0
force-ssl-common@1.1.0
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.1.2
htmljs@1.1.1
http@1.4.1
id-map@1.1.1
inter-process-messaging@0.1.1
lai:collection-extensions@0.3.0
leaonline:method-factory@1.1.0
leaonline:publication-factory@1.1.1
leaonline:ratelimit-factory@1.0.0
lmieulet:meteor-coverage@3.2.0
localstorage@1.2.0
logging@1.3.1
mdg:validated-method@1.2.0
meteor@1.10.0
meteor-base@1.5.1
meteortesting:browser-tests@1.3.5
meteortesting:mocha@2.0.3
meteortesting:mocha-core@8.0.1
minifier-css@1.6.0
minifier-js@2.7.3
minimongo@1.7.0
Expand All @@ -50,6 +65,7 @@ mongo-id@1.0.8
npm-mongo@3.9.1
ordered-dict@1.1.0
promise@0.12.0
raix:eventemitter@1.0.0
random@1.2.0
rate-limit@1.0.9
react-fast-refresh@0.2.2
Expand All @@ -65,6 +81,7 @@ standard-minifier-css@1.7.4
standard-minifier-js@2.8.0
static-html@1.3.2
templating-tools@1.2.1
tmeasday:check-npm-versions@1.0.2
tracker@1.2.0
typescript@4.4.1
underscore@1.0.10
Expand Down
33 changes: 33 additions & 0 deletions backend/.settingsschema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const SimpleSchema = require('simpl-schema')
const schema = def => new SimpleSchema(def)

const settingsSchema = schema({
remotes: schema({
content: schema({
url: String
})
}),
restore: schema({
codes: schema({
numberOfCodes: SimpleSchema.Integer,
length: SimpleSchema.Integer,
uppercase: Boolean,
forbidden: schema({
source: String,
flags: {
type: String,
optional: true
}
}),
maxRetries: SimpleSchema.Integer
})
}),
log: schema({
level: SimpleSchema.Integer
}),
public: schema({})
})

module.exports = function (settings) {
settingsSchema.validate(settings)
}
Loading