-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Adds unit and functional tests for api - Adds docker compose with db init script to seed from dump - Updates READMEs with relevant instructions
- Loading branch information
1 parent
46519bf
commit 0ae35fa
Showing
41 changed files
with
16,924 additions
and
11,273 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Validate and Build API | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
validate-n-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check for changes | ||
uses: dorny/paths-filter@v2 | ||
id: filter | ||
with: | ||
filters: | | ||
api: | ||
- 'api/**' | ||
shared: | ||
- 'shared/**' | ||
- name: Restore node_modules cache | ||
id: deps-cache | ||
uses: martijnhols/actions-cache/restore@v3 | ||
with: | ||
path: api/node_modules | ||
key: ${{ runner.os }}-build-api-deps-cache-${{ hashFiles('api/package-lock.json') }} | ||
|
||
- name: Install Dependencies | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
run: | | ||
cd api | ||
npm install | ||
- name: Cache node modules | ||
if: steps.deps-cache.outputs.cache-hit != 'true' | ||
uses: martijnhols/actions-cache/save@v3 | ||
with: | ||
path: api/node_modules | ||
key: ${{ runner.os }}-build-api-deps-cache-${{ hashFiles('api/package-lock.json') }} | ||
|
||
- name: Run static code analysis | ||
if: steps.filter.outputs.api == 'true' || steps.filter.outputs.shared == 'true' | ||
run: | | ||
cd api | ||
npm run lint | ||
- name: Run unit tests | ||
if: steps.filter.outputs.api == 'true' || steps.filter.outputs.shared == 'true' | ||
run: | | ||
cd api | ||
npm run test:unit | ||
- name: Build the Docker image for API | ||
if: steps.filter.outputs.api == 'true' || steps.filter.outputs.shared == 'true' | ||
run: docker build . --file ./api/Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,7 @@ dist | |
|
||
# IDE files | ||
.idea | ||
.vscode | ||
|
||
# yarn v2 | ||
.yarn/cache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=password | ||
POSTGRES_DBS_FOR_IMPORT=cloudmos-akash-sandbox | ||
POSTGRES_USERS_DB=cloudmos-users |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Network=sandbox | ||
AkashSandboxDatabaseCS=postgres://postgres:password@localhost:5432/cloudmos-akash-sandbox | ||
UserDatabaseCS=postgres://postgres:password@localhost:5432/cloudmos-users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,11 +36,12 @@ node_modules/ | |
|
||
#dotenv | ||
.env | ||
.env.local | ||
|
||
# akash | ||
/api/data | ||
|
||
.DS_Store | ||
.vim | ||
|
||
dist | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const MAP_ALIASES = { | ||
'^@src(.*)$': "<rootDir>/src$1", | ||
'^@shared/(.*)$': '<rootDir>/../shared/$1', | ||
}; | ||
const MAP_TO_SAME_SEQUELIZE_PACKAGE = { | ||
'^sequelize(.*)$': '<rootDir>/node_modules/sequelize$1', | ||
} | ||
|
||
const common = { | ||
transform: { | ||
'^.+\\.(t|j)s$': ['ts-jest', { tsconfig: './tsconfig.json' }], | ||
}, | ||
rootDir: '.', | ||
moduleNameMapper: { | ||
...MAP_ALIASES, | ||
...MAP_TO_SAME_SEQUELIZE_PACKAGE, | ||
}, | ||
setupFiles: ['./test/setup.ts'], | ||
}; | ||
|
||
module.exports = { | ||
collectCoverageFrom: ['./src/**/*.{js,ts}'], | ||
projects: [ | ||
{ | ||
displayName: 'unit', | ||
...common, | ||
testMatch: ['<rootDir>/src/**/*.spec.ts'], | ||
setupFilesAfterEnv: ['./test/setup-unit-tests.ts'], | ||
}, | ||
{ | ||
displayName: 'functional', | ||
...common, | ||
testMatch: ['<rootDir>/test/functional/**/*.spec.ts'], | ||
setupFilesAfterEnv: ['./test/setup-functional-tests.ts'], | ||
}, | ||
], | ||
}; |
Oops, something went wrong.