Skip to content
Merged
Prev Previous commit
Next Next commit
Enhance CI configurations and Docker setup for improved testing and p…
…erformance

- Updated .npmrc for CI builds with optimized fetch settings and logging.
- Modified .travis.yml to start Xvfb for headless Chrome testing.
- Enhanced docker-compose.yml with Chrome environment variables and resource limits.
- Improved karma.conf.js for better test execution in CI, including timeout adjustments.
- Updated Dockerfile to set Chrome environment variables for Travis CI.
  • Loading branch information
RishabhJain2018 committed Sep 2, 2025
commit 5a88552d5e27355892d9e68e39009f52cf7f0ef0
14 changes: 6 additions & 8 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# npm configuration for EvalAI
fund=false
audit=false
progress=true
loglevel=verbose
save-exact=false
legacy-peer-deps=true
registry=https://registry.npmjs.org/
# npm configuration for CI builds
fetch-timeout=600000
fetch-retry-mintimeout=20000
fetch-retry-maxtimeout=120000
progress=false
loglevel=warn
maxsockets=50
prefer-offline=true
audit=false
fund=false
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ before_install:
- echo "parallel = 1" >> $HOME/.config/pip/pip.conf
- ulimit -u 16384 # Increase process/thread limit
- ulimit -n 4096 # Increase open file limit
# Start Xvfb for Chrome headless testing
- sh -e /etc/init.d/xvfb start
- sleep 3 # Give Xvfb time to start

install:
- pip install awscli==1.18.66
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,29 @@ services:
dockerfile: docker/dev/nodejs/Dockerfile
environment:
NODE_ENV: development
CHROME_BIN: /usr/bin/google-chrome
DISPLAY: :99.0
ports:
- "8888:8888"
- "35729:35729"
volumes:
- .:/code
- /code/node_modules
- /code/bower_components
deploy:
resources:
limits:
memory: 2G
cpus: '1.0'
reservations:
memory: 1G
cpus: '0.5'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8888"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s

statsd-exporter:
hostname: statsd
Expand Down
10 changes: 9 additions & 1 deletion docker/dev/nodejs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ RUN apt-get update && \
python-is-python2 \
make \
g++ \
curl && \
curl \
wget \
gnupg \
ca-certificates && \
rm -rf /var/lib/apt/lists/*

WORKDIR /code
Expand Down Expand Up @@ -57,6 +60,11 @@ RUN apt-get update && apt-get install -yq chromium libxss1 && \
# Final stage - automatically selects the right architecture
FROM ${TARGETARCH:-amd64}

# Set Chrome environment variables for Travis CI
ENV CHROME_BIN=/usr/bin/google-chrome
ENV CHROME_PATH=/usr/bin/google-chrome
ENV DISPLAY=:99.0

# Copy source code
COPY . /code/

Expand Down
26 changes: 21 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ module.exports = function(config) {
flags: [
'--no-sandbox',
'--disable-gpu',
'--disable-dev-shm-usage'
'--disable-dev-shm-usage',
'--disable-web-security',
'--disable-features=VizDisplayCompositor'
]
},
ChromeWithNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
flags: [
'--no-sandbox',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-web-security',
'--disable-features=VizDisplayCompositor'
],
},
},

Expand Down Expand Up @@ -85,16 +93,21 @@ module.exports = function(config) {


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
autoWatch: false,


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
concurrency: 1,

// Browser disconnect timeout
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 60000,

coverageReporter: {
includeAllSources: true,
Expand All @@ -109,6 +122,9 @@ module.exports = function(config) {
// Detect if this is TravisCI running the tests and tell it to use chromium
if(process.env.TRAVIS){
configuration.browsers = ['ChromeWithNoSandbox'];
configuration.browserDisconnectTimeout = 20000;
configuration.browserDisconnectTolerance = 5;
configuration.browserNoActivityTimeout = 120000;
}

config.set(configuration);
Expand Down