Compare commits
4 Commits
developmen
...
v0.0.1-alp
Author | SHA1 | Date |
---|---|---|
![]() |
ee92c02baf | |
![]() |
a05aa86d7d | |
![]() |
48e41ab5b5 | |
![]() |
2eeae6d485 |
|
@ -0,0 +1,56 @@
|
||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: 'Tag to be released'
|
||||||
|
required: true
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master/**'
|
||||||
|
- 'feature/**'
|
||||||
|
- 'documentation/**'
|
||||||
|
- 'improvement/**'
|
||||||
|
- 'bugfix/**'
|
||||||
|
- 'w/**'
|
||||||
|
- 'q/**'
|
||||||
|
- 'hotfix/**'
|
||||||
|
- 'task/**'
|
||||||
|
- 'release/**'
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
verify-release:
|
||||||
|
name: Verify if tag is valid
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout arsenal-networking repository
|
||||||
|
uses: 'actions/checkout@v3'
|
||||||
|
with:
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Fetch tags
|
||||||
|
run: git fetch --tags
|
||||||
|
|
||||||
|
- name: 'Check if tag was already created'
|
||||||
|
shell: bash
|
||||||
|
run: >
|
||||||
|
git show-ref --tags v${{ github.event.inputs.tag }} --quiet \
|
||||||
|
&& exit 1 || exit 0
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- verify-release
|
||||||
|
steps:
|
||||||
|
- name: Create Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
name: Release ${{ github.event.inputs.tag }}
|
||||||
|
tag_name: v${{ github.event.inputs.tag }}
|
||||||
|
generate_release_notes: true
|
||||||
|
target_commitish: ${{ github.sha }}
|
|
@ -0,0 +1,36 @@
|
||||||
|
name: Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master/**'
|
||||||
|
- 'feature/**'
|
||||||
|
- 'documentation/**'
|
||||||
|
- 'improvement/**'
|
||||||
|
- 'bugfix/**'
|
||||||
|
- 'w/**'
|
||||||
|
- 'q/**'
|
||||||
|
- 'hotfix/**'
|
||||||
|
- 'task/**'
|
||||||
|
- 'release/**'
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install deps
|
||||||
|
run: sudo apt-get update -q
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '16'
|
||||||
|
- name: Install Yarn
|
||||||
|
run: npm install -g yarn
|
||||||
|
- name: install dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
- name: run lint
|
||||||
|
run: yarn run eslint
|
||||||
|
- name: run build
|
||||||
|
run: yarn build
|
|
@ -0,0 +1,10 @@
|
||||||
|
import httpAgent from "./lib/http-agent";
|
||||||
|
import httpsAgent from "./lib/https-agent";
|
||||||
|
|
||||||
|
export const http = {
|
||||||
|
Agent: httpAgent,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const https = {
|
||||||
|
Agent: httpsAgent,
|
||||||
|
};
|
|
@ -0,0 +1,6 @@
|
||||||
|
export default interface clientConfigurationDefault {
|
||||||
|
/**
|
||||||
|
* Maximum Socket Number: true if TCP session reuse must be enabled
|
||||||
|
*/
|
||||||
|
maxSockets?: boolean;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
import * as http from 'http';
|
||||||
|
import clientConfigurationDefault from './config/default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ClientHttp
|
||||||
|
* Abstracts the native http.Agent class to enforce common
|
||||||
|
* networking configuration across components.
|
||||||
|
*/
|
||||||
|
export default class ClientHttp extends http.Agent {
|
||||||
|
/**
|
||||||
|
* The maximum socket configuration defaults to 50.
|
||||||
|
*/
|
||||||
|
private static maxSocketsConfiguration = Number(process.env.MAX_SOCKETS) || 50;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the ClientHttp class
|
||||||
|
*
|
||||||
|
* @param opts - Custom HTTP Agent options
|
||||||
|
* @param config - user-defined default configuration du apply
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
opts?: http.AgentOptions,
|
||||||
|
config: clientConfigurationDefault = {
|
||||||
|
maxSockets: true,
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
// Enforce TCP session reuse configuration, unless explicitely specified.
|
||||||
|
const defaultConfigurations: http.AgentOptions = {};
|
||||||
|
if (config.maxSockets) {
|
||||||
|
defaultConfigurations.keepAlive = true;
|
||||||
|
defaultConfigurations.maxSockets = ClientHttp.maxSocketsConfiguration;
|
||||||
|
defaultConfigurations.maxFreeSockets = ClientHttp.maxSocketsConfiguration;
|
||||||
|
}
|
||||||
|
super({
|
||||||
|
...opts,
|
||||||
|
...defaultConfigurations,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
import * as https from 'https';
|
||||||
|
import clientConfigurationDefault from './config/default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class ClientHttps
|
||||||
|
* Abstracts the native https.Agent class to enforce common
|
||||||
|
* networking configuration across components.
|
||||||
|
*/
|
||||||
|
export default class ClientHttps extends https.Agent {
|
||||||
|
/**
|
||||||
|
* The maximum socket configuration defaults to 50.
|
||||||
|
*/
|
||||||
|
private static maxSocketsConfiguration = Number(process.env.MAX_SOCKETS) || 50;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the ClientHttps class
|
||||||
|
*
|
||||||
|
* @param opts - Custom HTTPs Agent options
|
||||||
|
* @param config - user-defined default configuration du apply
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
opts?: https.AgentOptions,
|
||||||
|
config: clientConfigurationDefault = {
|
||||||
|
maxSockets: true,
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
// Enforce TCP session reuse configuration, unless explicitely specified.
|
||||||
|
const defaultConfigurations: https.AgentOptions = {};
|
||||||
|
if (config.maxSockets) {
|
||||||
|
defaultConfigurations.keepAlive = true;
|
||||||
|
defaultConfigurations.maxSockets = ClientHttps.maxSocketsConfiguration;
|
||||||
|
defaultConfigurations.maxFreeSockets = ClientHttps.maxSocketsConfiguration;
|
||||||
|
}
|
||||||
|
super({
|
||||||
|
...opts,
|
||||||
|
...defaultConfigurations,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue