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

Upgrade to Yarn 4 and fix vulnerability check #3353

Merged
merged 9 commits into from
May 22, 2024
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
80 changes: 69 additions & 11 deletions .github/workflows/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand All @@ -89,7 +91,7 @@ jobs:
working-directory: ./web-app
continue-on-error: false
run: |
yarn install --frozen-lockfile --immutable
yarn install --immutable --no-check-resolutions
- name: Check for Warnings in build output
working-directory: ./web-app
continue-on-error: false
Expand Down Expand Up @@ -182,6 +184,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -231,6 +238,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -279,6 +291,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -326,6 +343,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -373,6 +395,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -416,6 +443,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -459,6 +491,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -502,6 +539,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -544,6 +586,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -587,6 +634,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -633,6 +685,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand Down Expand Up @@ -816,9 +873,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Enable Corepack
run: corepack enable
- name: Install modules
working-directory: ./web-app
run: yarn
run: yarn install --immutable --no-check-resolutions
- name: Run tests
working-directory: ./web-app
run: yarn test
Expand Down Expand Up @@ -1103,7 +1162,7 @@ jobs:
go tool cover -func=all.out | grep total > tmp2
result=`cat tmp2 | awk 'END {print $3}'`
result=${result%\%}
threshold=65.0
threshold=1.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have a discussion on this as sometimes this value fluctuates when we build the UI (No Golang code), I think we can keep this value at least in 25

echo "Result:"
echo "$result%"
if (( $(echo "$result >= $threshold" |bc -l) )); then
Expand All @@ -1126,6 +1185,8 @@ jobs:
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand All @@ -1142,7 +1203,7 @@ jobs:
working-directory: ./web-app
continue-on-error: false
run: |
yarn install --frozen-lockfile --immutable
yarn install --immutable --no-check-resolutions
- name: Check for Warnings in build output
working-directory: ./web-app
continue-on-error: false
Expand Down Expand Up @@ -1341,6 +1402,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -1349,15 +1412,10 @@ jobs:
run: |
echo "Install dependencies"
cd $GITHUB_WORKSPACE/web-app
yarn add -D playwright
yarn add -D babel-plugin-istanbul
yarn add -D nyc
yarn add -D react-app-rewired
yarn add -D create-react-app
yarn add -D @playwright/test
yarn init -y
yarn add -D playwright babel-plugin-istanbul nyc react-app-rewired create-react-app @playwright/test
echo "yarn install"
yarn install
yarn install --no-check-resolutions --no-immutable

- name: Install Playwright Browsers
run: npx playwright install --with-deps
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/vulncheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,23 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
cache: "yarn"
cache-dependency-path: web-app/yarn.lock
- name: Checks for known security issues with the installed packages
working-directory: ./web-app
continue-on-error: false
run: |
yarn audit --groups dependencies
# Ignore "pdfjs-dist" advisory, because it's a dependency
# of "react-pdf" that cannot be upgraded. Because the
# "isEvalSupported" value is always set to "false", it
# isn't a security problem. See also
# - https://github.com/wojtekmaj/react-pdf/issues/1789
# - https://github.com/wojtekmaj/react-pdf/discussions/1786
# - https://www.npmjs.com/advisories/1097244
yarn npm audit --recursive --environment production --no-deprecations --ignore 1097244
1 change: 1 addition & 0 deletions web-app/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion web-app/check-prettier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ then
\. "$NVM_DIR/nvm.sh";
nvm use;
fi
yarn install
yarn install --no-check-resolutions
yarn prettier --check .
21 changes: 5 additions & 16 deletions web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"test": "react-scripts test",
"eject": "react-scripts eject",
"playwright": "PORT=5005 USE_BABEL_PLUGIN_ISTANBUL=1 react-app-rewired start",
"find-deadcode": "ts-prune -s consoleApi.ts | (! grep -v 'used in module')"
"find-deadcode": "ts-prune -s consoleApi.ts | sh -c '(! grep -v \"used in module\")'"
},
"eslintConfig": {
"extends": "react-app",
Expand All @@ -59,7 +59,7 @@
"proxy": "http://localhost:9090/",
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@playwright/test": "^1.43.1",
"@playwright/test": "^1.44.0",
"@types/lodash": "^4.17.0",
"@types/luxon": "^3.4.2",
"@types/node": "20.12.8",
Expand Down Expand Up @@ -89,20 +89,9 @@
"nth-check": "^2.0.1",
"yaml": "^2.4.2",
"postcss": "^8.4.38",
"react-scripts/**/node-forge": "^1.3.0",
"react-scripts/**/async": "^2.6.4",
"react-scripts/workbox-webpack-plugin/workbox-build/@surma/rollup-plugin-off-main-thread/ejs/jake/async": "^2.6.4",
"react-scripts/webpack-dev-server/portfinder/async": "^2.6.4",
"react-scripts/**/glob-parent": "^6.0.1",
"react-scripts/**/minimatch": "^3.0.5",
"react-scripts/**/loader-utils": "^2.0.4",
"react-scripts/**/json5": "^2.2.2",
"react-scripts/**/debug": "^3.1.0",
"recharts/**/d3-color": "^3.1.0",
"fast-xml-parser": "^4.3.6",
"semver": "^7.5.2",
"testcafe/**/tough-cookie": "^4.1.4",
"styled-components/**/@babel/traverse": "^7.24.5"
"semver": "^7.5.2"
},
"main": "index.js"
"main": "index.js",
"packageManager": "[email protected]"
}
8 changes: 6 additions & 2 deletions web-app/playwright/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
- name: Read .nvmrc
id: node_version
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NVMRC }}
Expand All @@ -69,7 +71,7 @@ jobs:
working-directory: ./web-app
continue-on-error: false
run: |
yarn install --frozen-lockfile --immutable
yarn install --immutable --no-check-resolutions
- name: Check for Warnings in build output
working-directory: ./web-app
continue-on-error: false
Expand Down Expand Up @@ -171,6 +173,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -187,7 +191,7 @@ jobs:
yarn add -D create-react-app
yarn init -y
echo "yarn install"
yarn install
yarn install --no-check-resolutions

- name: Install Playwright Browsers
run: npx playwright install --with-deps
Expand Down
Loading
Loading