Skip to content

Commit 104f7f6

Browse files
authored
Merge pull request #28 from fraidakis/fraidakis
feat: add ESLint to CI/CD workflow
2 parents 007f120 + dae2b88 commit 104f7f6

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

.github/workflows/frontend-cicd.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,27 @@ jobs:
6868
- name: Install Frontend Dependencies
6969
run: npm ci --loglevel=error --no-audit --no-fund
7070

71-
# Step 7: Run Cypress End-to-End tests
71+
# Step 7: Run ESLint to ensure code quality
72+
- name: Run Lint
73+
run: npm run lint
74+
75+
# Step 8: Run Cypress End-to-End tests
7276
- name: Run Cypress E2E
7377
uses: cypress-io/github-action@v6
7478
with:
7579
install: false # Dependencies are already installed in a previous step
7680
start: npm start # Command to start the frontend application
7781
wait-on: ${{ env.CYPRESS_BASE_URL }} # Wait for the frontend to be available
78-
command: npm run test:e2e -- --env apiUrl=${{ env.REACT_APP_API_URL }} # Run E2E tests, passing backend API URL
82+
browser: chrome
83+
# Suppress WebGL warnings in headless CI environment
84+
command: npm run test:e2e -- --env apiUrl=${{ env.REACT_APP_API_URL }}
7985
env:
8086
CI: true # Indicate that tests are running in a CI environment
8187
CYPRESS_BASE_URL: 'http://localhost:3000' # Base URL for the frontend application
8288
REACT_APP_API_URL: 'http://localhost:3001' # API URL for the backend
89+
GENERATE_SOURCEMAP: false # Suppress source map warnings during build
90+
# Chrome flags for headless mode to suppress WebGL warnings
91+
ELECTRON_EXTRA_LAUNCH_ARGS: '--disable-gpu --enable-unsafe-swiftshader'
8392

8493
# Step 8: Upload Cypress screenshots if tests fail
8594
- name: Upload Cypress Screenshots

cypress.config.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = defineConfig({
3636
responseTimeout: 30000,
3737
execTimeout: 60000,
3838
taskTimeout: 60000,
39-
39+
4040
retries: {
4141
// Retry failed tests in CI/headless mode
4242
runMode: 1,
@@ -49,11 +49,11 @@ module.exports = defineConfig({
4949

5050
// Experiment features
5151
experimentalRunAllSpecs: true,
52-
52+
5353
// Security and stability
5454
chromeWebSecurity: true,
5555
modifyObstructiveCode: false,
56-
56+
5757
// Reporter configuration (for CI/CD)
5858
reporter: 'spec',
5959
reporterOptions: {
@@ -64,13 +64,13 @@ module.exports = defineConfig({
6464
env: {
6565
// API base URL for backend requests
6666
apiUrl: 'http://localhost:3001',
67-
67+
6868
// Test timeout multiplier for slower environments
6969
slowTestThreshold: 10000,
70-
70+
7171
// Coverage collection
7272
coverage: false,
73-
73+
7474
// Code coverage directory
7575
codeCoverage: {
7676
url: 'http://localhost:3001/__coverage__',
@@ -94,6 +94,26 @@ module.exports = defineConfig({
9494
console.log(` Duration: ${results.stats.duration}ms`);
9595
});
9696

97+
// Configure browser launch options
98+
on('before:browser:launch', (browser = {}, launchOptions) => {
99+
if (browser.family === 'chromium' || browser.name === 'chrome' || browser.name === 'electron') {
100+
// Fix for "Automatic fallback to software WebGL has been deprecated" in CI
101+
// These flags suppress WebGL warnings in headless/CI environments
102+
launchOptions.args.push('--enable-unsafe-swiftshader');
103+
launchOptions.args.push('--disable-gpu');
104+
launchOptions.args.push('--disable-software-rasterizer');
105+
launchOptions.args.push('--disable-dev-shm-usage');
106+
107+
// Only log in CI to avoid noise in local development
108+
if (process.env.CI) {
109+
console.log(`Injecting Chrome flags for ${browser.name}:`, launchOptions.args.filter(arg =>
110+
arg.includes('gpu') || arg.includes('swiftshader') || arg.includes('rasterizer')
111+
));
112+
}
113+
}
114+
return launchOptions;
115+
});
116+
97117
// Task for custom logging
98118
on('task', {
99119
log(message) {

package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
"test:e2e:chrome": "cypress run --browser chrome",
3939
"test:e2e:firefox": "cypress run --browser firefox"
4040
},
41-
"eslintConfig": {
42-
"extends": [
43-
"react-app",
44-
"react-app/jest"
45-
]
46-
},
4741
"browserslist": {
4842
"production": [
4943
">0.2%",
@@ -56,4 +50,4 @@
5650
"last 1 safari version"
5751
]
5852
}
59-
}
53+
}

0 commit comments

Comments
 (0)