mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-04-15 03:02:51 -05:00
build: enable Node 17 on CI and npm8 on E2E (#2795)
* chore: increase ci e2e settings * fix: ci for node 17 * chore: restore versions * chore: fix tests * chore: fix tests * chore: fix domain * chore: restore yarn on angular * chore: rename tests * chore: fix syntax * chore: disable yarn angular
This commit is contained in:
parent
e5d79ce8f0
commit
b2b3804f87
10 changed files with 172 additions and 110 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -9,7 +9,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node_version: [12, 14, 15, 16]
|
||||
node_version: [12, 14, 15, 16, 17]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
|
107
.github/workflows/e2e-angular-cli-workflow.yml
vendored
107
.github/workflows/e2e-angular-cli-workflow.yml
vendored
|
@ -7,42 +7,42 @@ on:
|
|||
|
||||
name: 'E2E Angular CLI with verdaccio'
|
||||
jobs:
|
||||
# todo: fix yarn global issue, cannot find ng
|
||||
# yarn:
|
||||
# name: 'yarn:angular example'
|
||||
# runs-on: ubuntu-latest
|
||||
#
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2.3.3
|
||||
#
|
||||
# - name: 'Use Node.js 10.x'
|
||||
# uses: actions/setup-node@v2.1.5
|
||||
# with:
|
||||
# node-version: 10.x
|
||||
# - name: Install Dependencies
|
||||
# run: yarn install --pure-lockfile
|
||||
# - name: 'Run verdaccio in the background'
|
||||
# run: |
|
||||
# nohup yarn node ./scripts/run-verdaccio.js &
|
||||
# - name: 'Ping to verdaccio'
|
||||
# run: |
|
||||
# npm ping --registry http://localhost:4873
|
||||
# - name: 'Running the integration test'
|
||||
# run: |
|
||||
# source scripts/e2e-setup-ci.sh
|
||||
# yarn init --yes
|
||||
#
|
||||
# yarn global add @angular/cli
|
||||
# which nodemon
|
||||
# ng new verdaccio-angular --interactive=false
|
||||
#
|
||||
# cd verdaccio-angular
|
||||
# echo "registry=http://localhost:4873" > ~/.npmrc
|
||||
# yarn add @angular-devkit/core@next @babel/preset-env @babel/core -D
|
||||
#
|
||||
# ng build --aot
|
||||
# todo: fix yarn global issue, cannot find ng
|
||||
# yarn:
|
||||
# name: 'yarn:angular example'
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2.3.3
|
||||
|
||||
# - name: 'Use Node.js 14.x'
|
||||
# uses: actions/setup-node@v2.1.5
|
||||
# with:
|
||||
# node-version: 14.x
|
||||
# - name: Install Dependencies
|
||||
# run: yarn install --pure-lockfile
|
||||
# - name: 'Run verdaccio in the background'
|
||||
# run: |
|
||||
# nohup yarn node ./scripts/run-verdaccio.js &
|
||||
# - name: 'Ping to verdaccio'
|
||||
# run: |
|
||||
# npm ping --registry http://localhost:4873
|
||||
# - name: 'Running the integration test'
|
||||
# run: |
|
||||
# source scripts/e2e-setup-ci.sh
|
||||
# yarn init --yes
|
||||
|
||||
# yarn global add @angular/cli
|
||||
# which nodemon
|
||||
# ng new verdaccio-angular --interactive=false
|
||||
|
||||
# cd verdaccio-angular
|
||||
# echo "registry=http://localhost:4873" > ~/.npmrc
|
||||
# yarn add @angular-devkit/core@next @babel/preset-env @babel/core -D
|
||||
|
||||
# ng build --aot
|
||||
npm:
|
||||
name: 'npm:angular example'
|
||||
name: 'npm6:angular example'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
@ -114,6 +114,43 @@ jobs:
|
|||
cd verdaccio-angular
|
||||
npm install @angular-devkit/core@next @babel/preset-env @babel/core -D
|
||||
|
||||
npm run ng build --aot
|
||||
npm8:
|
||||
name: 'npm8:angular example'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
|
||||
- name: 'Use Node.js 16.x'
|
||||
uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: 'install latest npm'
|
||||
run: npm i -g npm@next-8
|
||||
- name: Install Dependencies
|
||||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
- name: 'Running the integration test'
|
||||
run: |
|
||||
source scripts/e2e-setup-ci.sh
|
||||
echo "registry=http://localhost:4873" > ~/.npmrc
|
||||
npm config set loglevel="silent"
|
||||
npm config set fetch-retries="5"
|
||||
npm config set fetch-retry-factor="50"
|
||||
npm config set fetch-retry-mintimeout="20000"
|
||||
npm config set fetch-retry-maxtimeout="80000"
|
||||
npm install -g @angular/cli
|
||||
ng new verdaccio-angular --interactive=false
|
||||
|
||||
cd verdaccio-angular
|
||||
npm install @angular-devkit/core@next @babel/preset-env @babel/core -D
|
||||
|
||||
npm run ng build --aot
|
||||
|
||||
# pnpm throws errors worth to check why
|
||||
|
|
74
.github/workflows/e2e-gatsbyjs-cli-workflow.yml
vendored
74
.github/workflows/e2e-gatsbyjs-cli-workflow.yml
vendored
|
@ -7,7 +7,7 @@ on:
|
|||
|
||||
name: 'E2E Gatsby.js CLI with verdaccio'
|
||||
jobs:
|
||||
npm:
|
||||
npm6:
|
||||
name: 'npm:gatsby example'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -18,7 +18,7 @@ jobs:
|
|||
uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: 14.x
|
||||
- name: 'install latest npm'
|
||||
- name: 'install npm 6'
|
||||
run: npm i -g npm@latest-6
|
||||
- name: Install Dependencies
|
||||
run: yarn install
|
||||
|
@ -42,3 +42,73 @@ jobs:
|
|||
gatsby new my-gatsby
|
||||
cd my-gatsby
|
||||
npm run build
|
||||
npm7:
|
||||
name: 'npm7:gatsby example'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
|
||||
- name: 'Use Node.js 14.x'
|
||||
uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: 14.x
|
||||
- name: 'install npm 7'
|
||||
run: npm i -g npm@latest-7
|
||||
- name: Install Dependencies
|
||||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
- name: 'Running the integration test'
|
||||
run: |
|
||||
source scripts/e2e-setup-ci.sh
|
||||
echo "registry=http://localhost:4873
|
||||
loglevel="silent"
|
||||
fetch-retries=10
|
||||
fetch-retry-factor=2
|
||||
fetch-retry-mintimeout=10000
|
||||
fetch-retry-maxtimeout=80000" > ~/.npmrc
|
||||
npm config list
|
||||
npm i -g gatsby
|
||||
gatsby new my-gatsby
|
||||
cd my-gatsby
|
||||
npm run build
|
||||
npm8:
|
||||
name: 'npm8:gatsby example'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
|
||||
- name: 'Use Node.js 16.x'
|
||||
uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: 'install npm 8'
|
||||
run: npm i -g npm@next-8
|
||||
- name: Install Dependencies
|
||||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup yarn node ./scripts/run-verdaccio.js --config ./scripts/e2e-config.yaml &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
npm ping --registry http://localhost:4873
|
||||
- name: 'Running the integration test'
|
||||
run: |
|
||||
source scripts/e2e-setup-ci.sh
|
||||
echo "registry=http://localhost:4873
|
||||
loglevel="silent"
|
||||
fetch-retries=10
|
||||
fetch-retry-factor=2
|
||||
fetch-retry-mintimeout=10000
|
||||
fetch-retry-maxtimeout=80000" > ~/.npmrc
|
||||
npm config list
|
||||
npm i -g gatsby
|
||||
gatsby new my-gatsby
|
||||
cd my-gatsby
|
||||
npm run build
|
||||
|
|
35
.github/workflows/e2e-jest-workflow.yml
vendored
35
.github/workflows/e2e-jest-workflow.yml
vendored
|
@ -172,38 +172,3 @@ jobs:
|
|||
yarn add left-pad --registry http://localhost:4873 --verbose
|
||||
echo "const leftPad = require('left-pad'); it('should resolve a module', () => { expect(typeof leftPad).toBe('function');});" | tee module.test.js
|
||||
yarn jest module.test.js
|
||||
pnpm6:
|
||||
name: 'pnpm6:jest example'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.3
|
||||
|
||||
- name: 'Use Node.js 12.x'
|
||||
uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: 'install latest pnpm'
|
||||
run: sudo npm i pnpm@dev -g
|
||||
- name: Install Dependencies
|
||||
run: yarn install
|
||||
- name: 'Run verdaccio in the background'
|
||||
run: |
|
||||
nohup yarn node ./scripts/run-verdaccio.js &
|
||||
- name: 'Ping to verdaccio'
|
||||
run: |
|
||||
pnpm ping --registry http://localhost:4873
|
||||
- name: 'Running the integration test'
|
||||
run: |
|
||||
source scripts/e2e-setup-ci.sh
|
||||
pnpm init --force
|
||||
pnpm install jest --registry http://localhost:4873
|
||||
|
||||
echo "it('should pass', () => { expect(true).toBeTruthy(); });" | tee pass.test.js
|
||||
yarn jest pass.test.js
|
||||
|
||||
yarn add left-pad --registry http://localhost:4873 --verbose
|
||||
echo "const leftPad = require('left-pad'); it('should resolve a module', () => { expect(typeof leftPad).toBe('function');});" | tee module.test.js
|
||||
yarn jest module.test.js
|
||||
|
||||
|
||||
|
|
6
.pnp.js
generated
6
.pnp.js
generated
|
@ -7575,14 +7575,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||
]],
|
||||
["core-js", [
|
||||
["npm:2.6.9", {
|
||||
"packageLocation": "./.yarn/cache/core-js-npm-2.6.9-f821bf686c-00c30207eb.zip/node_modules/core-js/",
|
||||
"packageLocation": "./.yarn/unplugged/core-js-npm-2.6.9-f821bf686c/node_modules/core-js/",
|
||||
"packageDependencies": [
|
||||
["core-js", "npm:2.6.9"]
|
||||
],
|
||||
"linkType": "HARD",
|
||||
}],
|
||||
["npm:3.19.1", {
|
||||
"packageLocation": "./.yarn/cache/core-js-npm-3.19.1-772a85cbf5-32b2ecead4.zip/node_modules/core-js/",
|
||||
"packageLocation": "./.yarn/unplugged/core-js-npm-3.19.1-772a85cbf5/node_modules/core-js/",
|
||||
"packageDependencies": [
|
||||
["core-js", "npm:3.19.1"]
|
||||
],
|
||||
|
@ -14428,7 +14428,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||
]],
|
||||
["puppeteer", [
|
||||
["npm:5.5.0", {
|
||||
"packageLocation": "./.yarn/cache/puppeteer-npm-5.5.0-bba75ba998-08ba8a7da5.zip/node_modules/puppeteer/",
|
||||
"packageLocation": "./.yarn/unplugged/puppeteer-npm-5.5.0-bba75ba998/node_modules/puppeteer/",
|
||||
"packageDependencies": [
|
||||
["puppeteer", "npm:5.5.0"],
|
||||
["debug", "virtual:24c0670a0dd5336de8e9d36ce94c8b696cc66bf2f157358e53a1649e6047bfc20104ef799a035ae68ee7761447ecfa64a6d54a5971d436f7ea6ab984abfab5de#npm:4.1.1"],
|
||||
|
|
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
|
@ -4,6 +4,7 @@
|
|||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
"processId": "${command:PickProcess}",
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
|
|
|
@ -1 +1 @@
|
|||
export const DOMAIN_SERVERS = '0.0.0.0';
|
||||
export const DOMAIN_SERVERS = 'localhost';
|
||||
|
|
|
@ -95,7 +95,7 @@ describe('endpoint unit test', () => {
|
|||
test('should perform a search with results', (done) => {
|
||||
const searchAllResponse = require(path.join(__dirname, 'partials', 'search-all.json'));
|
||||
const query = '/-/all/since?stale=update_after&startkey=111';
|
||||
nock('http://0.0.0.0:55549').get(query).reply(200, searchAllResponse);
|
||||
nock('http://localhost:55549').get(query).reply(200, searchAllResponse);
|
||||
request(app)
|
||||
.get('/-/all/since?stale=update_after&startkey=111')
|
||||
.set('accept-encoding', HEADERS.JSON)
|
||||
|
@ -118,7 +118,7 @@ describe('endpoint unit test', () => {
|
|||
const searchV1 = require(path.join(__dirname, 'partials', 'search-v1-empty.json'));
|
||||
const query = '/-/v1/search?text=verdaccio&size=3&quality=0.65&popularity=0.98&maintenance=0.5';
|
||||
jest.spyOn(Date.prototype, 'toUTCString').mockReturnValue('Fri, 14 May 2021 21:29:10 GMT');
|
||||
nock('http://0.0.0.0:55549').get(query).reply(200, searchV1);
|
||||
nock('http://localhost:55549').get(query).reply(200, searchV1);
|
||||
request(app)
|
||||
.get(query)
|
||||
.set('accept-encoding', HEADERS.JSON)
|
||||
|
@ -139,7 +139,7 @@ describe('endpoint unit test', () => {
|
|||
const searchV1 = require(path.join(__dirname, 'partials', 'search-v1.json'));
|
||||
const query = '/-/v1/search?text=verdaccio&size=3&quality=0.65&popularity=0.98&maintenance=0.5';
|
||||
jest.spyOn(Date.prototype, 'toUTCString').mockReturnValue('Fri, 14 May 2021 21:29:10 GMT');
|
||||
nock('http://0.0.0.0:55549').get(query).reply(200, searchV1);
|
||||
nock('http://localhost:55549').get(query).reply(200, searchV1);
|
||||
request(app)
|
||||
.get(query)
|
||||
.set('accept-encoding', HEADERS.JSON)
|
||||
|
@ -162,7 +162,7 @@ describe('endpoint unit test', () => {
|
|||
const searchV1 = require(path.join(__dirname, 'partials', 'search-v1-forbidden.json'));
|
||||
const query = '/-/v1/search?text=verdaccio&size=3&quality=0.65&popularity=0.98&maintenance=0.5';
|
||||
jest.spyOn(Date.prototype, 'toUTCString').mockReturnValue('Fri, 14 May 2021 21:29:10 GMT');
|
||||
nock('http://0.0.0.0:55549').get(query).reply(200, searchV1);
|
||||
nock('http://localhost:55549').get(query).reply(200, searchV1);
|
||||
request(app)
|
||||
.get(query)
|
||||
.set('accept-encoding', HEADERS.JSON)
|
||||
|
@ -183,7 +183,7 @@ describe('endpoint unit test', () => {
|
|||
|
||||
test('should perform a search v1 with error', () => {
|
||||
const query = '/-/v1/search?text=verdaccio&size=3&quality=0.65&popularity=0.98&maintenance=0.5';
|
||||
nock('http://0.0.0.0:55549').get(query).reply(500);
|
||||
nock('http://localhost:55549').get(query).reply(500);
|
||||
return request(app)
|
||||
.get(query)
|
||||
.set('accept-encoding', HEADERS.JSON)
|
||||
|
|
|
@ -24,9 +24,9 @@ const generateStorage = async function (port = mockServerPort) {
|
|||
storage: storagePath,
|
||||
uplinks: {
|
||||
npmjs: {
|
||||
url: `http://${DOMAIN_SERVERS}:${port}`
|
||||
}
|
||||
}
|
||||
url: `http://${DOMAIN_SERVERS}:${port}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
'store.spec.yaml'
|
||||
);
|
||||
|
@ -47,24 +47,24 @@ const generateSameUplinkStorage = async function (port = mockServerPort) {
|
|||
jquery: {
|
||||
access: ['$all'],
|
||||
publish: ['$all'],
|
||||
proxy: ['cached']
|
||||
proxy: ['cached'],
|
||||
},
|
||||
'@jquery/*': {
|
||||
access: ['$all'],
|
||||
publish: ['$all'],
|
||||
proxy: ['notcached']
|
||||
}
|
||||
proxy: ['notcached'],
|
||||
},
|
||||
},
|
||||
uplinks: {
|
||||
cached: {
|
||||
url: `http://${DOMAIN_SERVERS}:${port}`,
|
||||
cache: true
|
||||
cache: true,
|
||||
},
|
||||
notcached: {
|
||||
url: `http://${DOMAIN_SERVERS}:${port}`,
|
||||
cache: false
|
||||
}
|
||||
}
|
||||
cache: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
'store.spec.yaml'
|
||||
);
|
||||
|
@ -80,7 +80,7 @@ const createNullStream = () =>
|
|||
new Writable({
|
||||
write: function (chunk, encoding, next) {
|
||||
next();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
describe('StorageTest', () => {
|
||||
|
@ -115,7 +115,7 @@ describe('StorageTest', () => {
|
|||
reader.on('end', () => {
|
||||
expect(notcachedSpy).toHaveBeenCalledTimes(0);
|
||||
expect(cachedSpy).toHaveBeenCalledTimes(1);
|
||||
expect(cachedSpy).toHaveBeenCalledWith('http://0.0.0.0:55548/jquery/-/jquery-1.5.1.tgz');
|
||||
expect(cachedSpy).toHaveBeenCalledWith('http://localhost:55548/jquery/-/jquery-1.5.1.tgz');
|
||||
res();
|
||||
});
|
||||
reader.on('error', (err) => {
|
||||
|
@ -133,9 +133,7 @@ describe('StorageTest', () => {
|
|||
reader.on('end', () => {
|
||||
expect(cachedSpy).toHaveBeenCalledTimes(0);
|
||||
expect(notcachedSpy).toHaveBeenCalledTimes(1);
|
||||
expect(notcachedSpy).toHaveBeenCalledWith(
|
||||
'http://0.0.0.0:55548/@jquery%2fjquery/-/jquery-1.5.1.tgz'
|
||||
);
|
||||
expect(notcachedSpy).toHaveBeenCalledWith('http://localhost:55548/@jquery%2fjquery/-/jquery-1.5.1.tgz');
|
||||
res();
|
||||
});
|
||||
reader.on('error', (err) => {
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('UpStorge', () => {
|
|||
const mockServerPort = 55547;
|
||||
let mockRegistry;
|
||||
const uplinkDefault = {
|
||||
url: `http://0.0.0.0:${mockServerPort}`
|
||||
url: `http://localhost:${mockServerPort}`,
|
||||
};
|
||||
const generateProxy = (config: UpLinkConf = uplinkDefault) => {
|
||||
const appConfig: Config = new AppConfig(configExample());
|
||||
|
@ -150,10 +150,7 @@ describe('UpStorge', () => {
|
|||
|
||||
describe('UpStorge::isUplinkValid', () => {
|
||||
describe('valid use cases', () => {
|
||||
const validateUpLink = (
|
||||
url: string,
|
||||
tarBallUrl = `${url}/artifactory/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz`
|
||||
) => {
|
||||
const validateUpLink = (url: string, tarBallUrl = `${url}/artifactory/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz`) => {
|
||||
const uplinkConf = { url };
|
||||
const proxy: IProxy = generateProxy(uplinkConf);
|
||||
|
||||
|
@ -183,12 +180,7 @@ describe('UpStorge', () => {
|
|||
// corner case https://github.com/verdaccio/verdaccio/issues/571
|
||||
test('should validate tarball path against uplink case#6', () => {
|
||||
// same protocol, same domain, port === 443 which is also the standard for https
|
||||
expect(
|
||||
validateUpLink(
|
||||
'https://my.domain.test',
|
||||
`https://my.domain.test:443/artifactory/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz`
|
||||
)
|
||||
).toBe(true);
|
||||
expect(validateUpLink('https://my.domain.test', `https://my.domain.test:443/artifactory/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz`)).toBe(true);
|
||||
});
|
||||
|
||||
test('should validate tarball path against uplink case#7', () => {
|
||||
|
@ -233,8 +225,7 @@ describe('UpStorge', () => {
|
|||
test('should fails on validate tarball path against uplink case#4', () => {
|
||||
// same domain, same protocol, different port
|
||||
const url = 'https://subdomain.domain:5001';
|
||||
const tarBallUrl =
|
||||
'https://subdomain.domain:4000/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz';
|
||||
const tarBallUrl = 'https://subdomain.domain:4000/api/npm/npm/pk1-juan/-/pk1-juan-1.0.7.tgz';
|
||||
const uplinkConf = { url };
|
||||
const proxy: IProxy = generateProxy(uplinkConf);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue