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

ci(github-actions): run all tests on PR to develop #1476

Merged
merged 4 commits into from
Apr 18, 2022
Merged
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
133 changes: 127 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,124 @@
name: Lint root
name: Lint and test
on:
push:
branches:
- staging
- master
- github-actions-test
pull_request:
branches:
- develop

jobs:
ci:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "12"
cache: "npm"
- name: Lint lock file
run: npx lockfile-lint --type npm --path package-lock.json -o "https:" -o "file:" --allowed-hosts npm
- run: npm ci --ignore-scripts
- name: Lint app code
run: npm run lint-no-fix
- name: Lint secrets
run: npm run secretlint
test-backend:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:alpine
ports:
- "6379:6379"
options: --entrypoint redis-server
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "12"
cache: "npm"
- name: Lint lock file
run: npx lockfile-lint --type npm --path package-lock.json -o "https:" -o "file:" --allowed-hosts npm

# building shared components from source file to avoid
# "d.ts files are not built from source" errors
- run: npm ci
working-directory: ./shared
- run: npm run build
working-directory: ./shared

- run: npm ci
- name: Lint app code
run: npm run lint-no-fix
- name: Run tests
run: npm test
env:
PGUSER: postgres
PGPASSWORD: postgres
test-shared:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./shared
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "12"
cache: "npm"
- name: Lint lock file
run: npx lockfile-lint --type npm --path package-lock.json -o "https:" -o "file:" --allowed-hosts npm
- run: npm ci
- name: Lint app code
run: npm run lint-no-fix
- name: Run tests
run: npm test
test-worker:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./worker
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "12"
cache: "npm"
- name: Lint lock file
run: npx lockfile-lint --type npm --path package-lock.json -o "https:" -o "file:" --allowed-hosts npm

# building shared components from source file to avoid
# "d.ts files are not built from source" errors
- run: npm ci
working-directory: ./shared
- run: npm run build
working-directory: ./shared

- run: npm ci
- name: Lint app code
run: npm run lint-no-fix
test-frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
Expand All @@ -16,7 +127,17 @@ jobs:
cache: "npm"
- name: Lint lock file
run: npx lockfile-lint --type npm --path package-lock.json -o "https:" -o "file:" --allowed-hosts npm

# building shared components from source file to avoid
# "d.ts files are not built from source" errors
- run: npm ci
working-directory: ./shared
- run: npm run build
working-directory: ./shared

- run: npm ci
- run: npm run compile
- name: Lint app code
run: |
npm install --ignore-scripts
npm run lint-no-fix
run: npm run lint-no-fix
- name: Run tests
run: npm test
4 changes: 4 additions & 0 deletions .secretlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/.env
**/.env*
**/examples/**
**/*.pem
6 changes: 5 additions & 1 deletion frontend/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ module.exports.jest = (config) => {
'^@shared/?(.*)': '<rootDir>/../shared/src/$1',
}
const moduleNameMapper = { ...config.moduleNameMapper, ...aliasMap }
return { ...config, moduleNameMapper }
return {
...config,
setupFilesAfterEnv: ['./src/setupTests.ts'],
moduleNameMapper,
}
}
Loading