Skip to content

Commit

Permalink
Merge pull request #1496 from rodekruis/wip.email-multi-event
Browse files Browse the repository at this point in the history
Wip.email multi event
  • Loading branch information
gulfaraz authored Jul 15, 2024
2 parents 69f9922 + 230d09e commit 53bc5ff
Show file tree
Hide file tree
Showing 199 changed files with 4,580 additions and 2,276 deletions.
208 changes: 104 additions & 104 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
name: "Continuous Integration for IBF"
name: 'Continuous Integration for IBF'

on:
push:
branches: [master]
paths-ignore:
- "./package.json"
- "./COMMITLOG.md"
pull_request:
branches: [master]
push:
branches: [master]
paths-ignore:
- './package.json'
- './COMMITLOG.md'
pull_request:
branches: [master]

jobs:
detect-changes:
runs-on: ubuntu-latest

outputs:
ibf-api-service: ${{ steps.filter.outputs.ibf-api-service }}
ibf-dashboard: ${{ steps.filter.outputs.ibf-dashboard }}

steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
ibf-api-service:
- "services/API-service/**"
ibf-dashboard:
- "interfaces/IBF-dashboard/**"
ibf-api-service:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.ibf-api-service == 'true' }}

runs-on: ubuntu-latest

detect-changes:
runs-on: ubuntu-latest

outputs:
ibf-api-service: ${{ steps.filter.outputs.ibf-api-service }}
ibf-dashboard: ${{ steps.filter.outputs.ibf-dashboard }}

steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
ibf-api-service:
- "services/API-service/**"
ibf-dashboard:
- "interfaces/IBF-dashboard/**"
ibf-api-service:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.ibf-api-service == 'true' }}

runs-on: ubuntu-latest

env:
SECRET: ${{ secrets.SECRET }}
MC_API: ${{ secrets.MC_API }}

strategy:
matrix:
node-version: [17.x]

defaults:
run:
working-directory: 'services/API-service'

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-audit
- run: npm run lint
- run: npm test
- run: docker build . --file Dockerfile --tag
rodekruis/ibf-api-service:$(date +%s)

ibf-dashboard:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.ibf-dashboard == 'true' }}

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

defaults:
run:
working-directory: 'interfaces/IBF-dashboard'

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-audit
- run: npm test
- run: docker build . --file Dockerfile --tag
rodekruis/ibf-dashboard:$(date +%s)

bump-version:
needs: [ibf-api-service, ibf-dashboard]
if: |
always() &&
github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- name: Wait for previous workflow to complete
uses: softprops/turnstyle@v1
with:
abort-after-seconds: 1800
env:
SECRET: ${{ secrets.SECRET }}
MC_API: ${{ secrets.MC_API }}

strategy:
matrix:
node-version: [12.x]

defaults:
run:
working-directory: "services/API-service"

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-audit
- run: npm run lint
- run: npm test
- run: docker build . --file Dockerfile --tag
rodekruis/ibf-api-service:$(date +%s)

ibf-dashboard:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.ibf-dashboard == 'true' }}

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

defaults:
run:
working-directory: "interfaces/IBF-dashboard"

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
- run: npm ci --no-audit
- run: npm test
- run: docker build . --file Dockerfile --tag
rodekruis/ibf-dashboard:$(date +%s)

bump-version:
needs: [ibf-api-service, ibf-dashboard]
if: |
always() &&
github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- name: Wait for previous workflow to complete
uses: softprops/turnstyle@v1
with:
abort-after-seconds: 1800
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3

- name: Bump version and push tag
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-message: "chore(release): {version}"
release-count: 10
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3

- name: Bump version and push tag
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
git-message: 'chore(release): {version}'
release-count: 10
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80,
"no-parameter-properties": true,
"tabWidth": 2
}
6 changes: 2 additions & 4 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
version: '3.8'

services:
ibf-api-service:
command: [ 'npm', 'run', 'start:dev' ]
command: ['npm', 'run', 'start:dev']
environment:
- NODE_ENV=development
- LOCAL_PORT_IBF_SERVICE=${LOCAL_PORT_IBF_SERVICE}
Expand All @@ -16,7 +14,7 @@ services:
- api-network

ibf-dashboard:
entrypoint: [ 'echo', 'Service ibf-dashboard disabled' ]
entrypoint: ['echo', 'Service ibf-dashboard disabled']

ibf-geoserver:
ports:
Expand Down
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GEOSERVER_ADMIN_PASSWORD=

# interfaces/IBF-dashboard
NG_CONFIGURATION=
NG_API_URL=
NG_API_URL= # URL should not end with trailing slash
NG_USE_SERVICE_WORKER=
NG_GEOSERVER_URL=
NG_IBF_SYSTEM_VERSION=
Expand Down
1 change: 0 additions & 1 deletion services/API-service/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# IDE / Editors
.vscode
.idea
*.sublime-project
*.sublime-workspace
Expand Down
2 changes: 1 addition & 1 deletion services/API-service/.node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v10.15.3
v17.9.1
17 changes: 17 additions & 0 deletions services/API-service/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated files
dist
coverage
www


# External code
node_modules


# Raster-files
geoserver-volume/raster-files/*
!geoserver-volume/raster-files/README.md


# certificates
cert/
5 changes: 4 additions & 1 deletion services/API-service/.prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ module.exports = {
trailingComma: 'all',
singleQuote: true,
printWidth: 80,
'no-parameter-properties': true,
tabWidth: 2,
plugins: ['@ianvs/prettier-plugin-sort-imports'],
importOrder: ['^@nestjs', '', '<THIRD_PARTY_MODULES>', '', '^[.]'],
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
importOrderTypeScriptVersion: '5.0.0',
};
4 changes: 4 additions & 0 deletions services/API-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ For the rest, follow the same instructions as above to receive initial and follo
- Endpoint URL: `https://ibf.510.global/api/point-data/community-notification/${countryCodeISO3}`
- To test this locally you can replace `ibf.510.global` by a local ngrok address
- To demo on other environments, replace by respective environment-url, e.g. `ibf-test.510.global`

## API tests

1. Run them by `docker exec ibf-api-service npm run test:api:all`
2 changes: 2 additions & 0 deletions services/API-service/appdatasource.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { DataSource, DataSourceOptions } from 'typeorm';

import { ORMConfig } from './ormconfig';

export const AppDataSource = new DataSource(ORMConfig as DataSourceOptions);
16 changes: 16 additions & 0 deletions services/API-service/jest.api.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
moduleFileExtensions: ['js', 'ts'],
transform: {
'^.+\\.ts?$': ['ts-jest', { tsconfig: '<rootDir>/test/tsconfig.json' }],
},
rootDir: '.',
testMatch: ['<rootDir>/test/**/*.test.ts'],
coverageReporters: ['json', 'lcov'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
testTimeout: 30_000,
verbose: true,
reporters: ['default'],
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import * as fs from 'fs';
import * as path from 'path';

import { MigrationInterface, QueryRunner } from 'typeorm';

export class RenameMockRasters1710512991479 implements MigrationInterface {
public async up(_queryRunner: QueryRunner): Promise<void> {
const directoryPath = './geoserver-volume/raster-files/mock-output/';
Expand All @@ -13,8 +14,6 @@ export class RenameMockRasters1710512991479 implements MigrationInterface {

if (fs.existsSync(directoryPath)) {
const files = fs.readdirSync(directoryPath);
console.log('🚀 ~ RenameMockRasters1710512991479 ~ up ~ files:', files);

files.forEach((file) => {
if (!file.includes('hour_MWI')) {
const newFilename = file.replace(
Expand Down
1 change: 1 addition & 0 deletions services/API-service/ormconfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as fs from 'fs';

import { DataSourceOptions } from 'typeorm';

export const ORMConfig: DataSourceOptions = {
Expand Down
Loading

0 comments on commit 53bc5ff

Please sign in to comment.