Skip to content

Commit

Permalink
fix: lint scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Apr 1, 2022
1 parent b8a61fc commit e1b4d8a
Show file tree
Hide file tree
Showing 8 changed files with 245 additions and 102 deletions.
85 changes: 74 additions & 11 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,60 @@ functions:
NO_EXIT=${NO_EXIT|1} \
LOAD_BALANCER="${LOAD_BALANCER}" \
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
run checks:
- command: shell.exec
type: test
run lint checks:
- command: subprocess.exec
params:
working_dir: src
script: |
${PREPARE_SHELL}
bash ${PROJECT_DIRECTORY}/.evergreen/run-checks.sh
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-lint-checks.sh
run unit tests:
- command: subprocess.exec
params:
working_dir: src
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-unit-tests.sh
run typescript next:
- command: subprocess.exec
params:
working_dir: src
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
TS_VERSION: next
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript-next.sh
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh
run typescript oldest:
- command: subprocess.exec
params:
working_dir: src
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
TS_VERSION: 4.1.6
TRY_COMPILING_DRIVER: 'false'
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh
run typescript current:
- command: subprocess.exec
params:
working_dir: src
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
TS_VERSION: ''
binary: bash
args:
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh
run mongosh integration tests:
- command: shell.exec
type: test
Expand Down Expand Up @@ -1744,14 +1780,22 @@ tasks:
- func: add aws auth variables to file
- func: setup aws env
- func: run aws ECS auth test
- name: run-checks
- name: run-unit-tests
tags:
- run-unit-tests
commands:
- func: install dependencies
vars:
NODE_LTS_NAME: erbium
- func: run unit tests
- name: run-lint-checks
tags:
- run-checks
- run-lint-checks
commands:
- func: install dependencies
vars:
NODE_LTS_NAME: erbium
- func: run checks
- func: run lint checks
- name: run-typescript-next
tags:
- run-typescript-next
Expand All @@ -1760,6 +1804,22 @@ tasks:
vars:
NODE_LTS_NAME: erbium
- func: run typescript next
- name: run-typescript-current
tags:
- run-typescript-current
commands:
- func: install dependencies
vars:
NODE_LTS_NAME: erbium
- func: run typescript current
- name: run-typescript-oldest
tags:
- run-typescript-oldest
commands:
- func: install dependencies
vars:
NODE_LTS_NAME: erbium
- func: run typescript oldest
- name: run-mongosh-integration-tests
tags:
- run-mongosh-integration-tests
Expand Down Expand Up @@ -2325,7 +2385,10 @@ buildvariants:
display_name: lint
run_on: ubuntu1804-large
tasks:
- run-checks
- run-unit-tests
- run-lint-checks
- run-typescript-current
- run-typescript-oldest
- run-typescript-next
- name: mongosh_integration_tests
display_name: mongosh integration tests
Expand Down
53 changes: 46 additions & 7 deletions .evergreen/config.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,27 @@ functions:
LOAD_BALANCER="${LOAD_BALANCER}" \
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh

"run checks":
- command: shell.exec
type: test
"run lint checks":
- command: subprocess.exec
params:
working_dir: "src"
script: |
${PREPARE_SHELL}
bash ${PROJECT_DIRECTORY}/.evergreen/run-checks.sh
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
binary: bash
args:
- "${PROJECT_DIRECTORY}/.evergreen/run-lint-checks.sh"

"run unit tests":
- command: subprocess.exec
params:
working_dir: "src"
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
binary: bash
args:
- "${PROJECT_DIRECTORY}/.evergreen/run-unit-tests.sh"

"run typescript next":
- command: subprocess.exec
Expand All @@ -254,9 +267,35 @@ functions:
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
TS_VERSION: "next"
binary: bash
args:
- "${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh"

"run typescript oldest":
- command: subprocess.exec
params:
working_dir: "src"
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
TS_VERSION: "4.1.6"
TRY_COMPILING_DRIVER: "false" # 4.1.6 can consume the public API but not compile the driver
binary: bash
args:
- "${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh"

"run typescript current":
- command: subprocess.exec
params:
working_dir: "src"
timeout_secs: 60
env:
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
TS_VERSION: "" # leaving this empty will use the version in package-lock.json
binary: bash
args:
- "${PROJECT_DIRECTORY}/.evergreen/run-typescript-next.sh"
- "${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh"

"run mongosh integration tests":
- command: shell.exec
Expand Down
94 changes: 71 additions & 23 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,39 +578,87 @@ OPERATING_SYSTEMS.forEach(
);

// singleton build variant for linting
SINGLETON_TASKS.push({
name: 'run-checks',
tags: ['run-checks'],
commands: [
SINGLETON_TASKS.push(
...[
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
name: 'run-unit-tests',
tags: ['run-unit-tests'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
},
{ func: 'run unit tests' }
]
},
{ func: 'run checks' }
]
});

SINGLETON_TASKS.push({
name: 'run-typescript-next',
tags: ['run-typescript-next'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
name: 'run-lint-checks',
tags: ['run-lint-checks'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
},
{ func: 'run lint checks' }
]
},
{ func: 'run typescript next' }
{
name: 'run-typescript-next',
tags: ['run-typescript-next'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
},
{ func: 'run typescript next' }
]
},
{
name: 'run-typescript-current',
tags: ['run-typescript-current'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
},
{ func: 'run typescript current' }
]
},
{
name: 'run-typescript-oldest',
tags: ['run-typescript-oldest'],
commands: [
{
func: 'install dependencies',
vars: {
NODE_LTS_NAME: LOWEST_LTS
}
},
{ func: 'run typescript oldest' }
]
}
]
});
);

BUILD_VARIANTS.push({
name: 'lint',
display_name: 'lint',
run_on: DEFAULT_OS,
tasks: ['run-checks', 'run-typescript-next']
tasks: [
'run-unit-tests',
'run-lint-checks',
'run-typescript-current',
'run-typescript-oldest',
'run-typescript-next'
]
});

// TODO NODE-3897 - generate combined coverage report
Expand Down
41 changes: 0 additions & 41 deletions .evergreen/run-checks.sh

This file was deleted.

19 changes: 19 additions & 0 deletions .evergreen/run-lint-checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -o errexit # Exit the script with error if any of the commands fail

source "${PROJECT_DIRECTORY}/.evergreen/init-nvm.sh"

# Attempt to update our EVG config
# if it changes, crash so that any gen script changes are forced to be run before pushing
set +o xtrace
echo "Running evergreen config generation, expecting no changes..."
npm run build:evergreen
if ! git diff --exit-code ./.evergreen/config.yml; then
echo "Detected .evergreen/config.yml not up to date"
echo "Make sure to run: node .evergreen/generate_evergreen_tasks.js"
exit 1
fi
set -o xtrace

## Checks typescript, eslint, and prettier
npm run check:lint
20 changes: 0 additions & 20 deletions .evergreen/run-typescript-next.sh

This file was deleted.

Loading

0 comments on commit e1b4d8a

Please sign in to comment.