Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • pokapow/duniter
  • pini-gh/duniter
  • elberto2008/duniter
  • diaspogift/duniter
  • d0p1/duniter
  • nodes/typescript/duniter
  • aya/duniter
  • tuxmain/duniter
  • thomasbromehead/duniter
  • Bertrandbenj/duniter
  • Tuxicoman/duniter
  • bpresles/duniter
  • ji_emme/duniter
  • tykayn/duniter
  • 1000i100/duniter
  • 666titi999/duniter
  • blavenie/duniter
17 results
Select Git revision
Loading items
Show changes
Commits on Source (2890)
Showing
with 836 additions and 10 deletions
[alias]
bdex = "build --release --package duniter-dbex"
ca = "check --all"
cn = "check --manifest-path neon/native/Cargo.toml"
dex = "run --release --package duniter-dbex --"
ta = "test --all"
rr = "run --release --"
uc = "update -p duniter-core"
ug = "update -p duniter-gva"
ugc = "update -p duniter-gva-conf"
xtask = "run --package xtask --"
# Do not edit this file. It is generated from this command:
# ./dockerignore.make
.cargo
.git*
doc
dockerignore.make
gui
test
# ------------------
# .gitignore content
# ------------------
*.sublime*
node_modules/
*.html
npm-debug.log
bin/jpgp*.jar
.idea/
gui/nw
# Vim swap files
*~
*.swp
*.swo
# Vagrant
.vagrant/
vagrant/*.log
vagrant/duniter
# Python compiled
*.pyc
# Releases
/work
*.deb
*.tar.gz
*.log
*.exe
# vscode
.vscode
# istanbul
.nyc_output
coverage/
# typecode
typedoc/
# files generated by tsc
/index.js*
/index.d.ts
/server.js*
/server.d.ts
*/**/*.js*
app/**/*.d.ts
neon/lib/*.d.ts
test/**/*.d.ts
# files generated by neon
neon/native/artifacts.json
# rust binaries
bin/duniter
neon/native/index.node
target
# files generated by rust tests
neon/native/tests/*.txt
neon/native/tests/wotb-*
test2.bin.gz
**/*.wot
app/*.js
app/**/*.js
test/*.js
test/**/*.js
\ No newline at end of file
{
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
"plugins": [
"mocha"
],
// "ecmaFeatures": {
// "arrowFunctions": true,
// "generators": true
// },
"ecmaFeatures": {
"arrowFunctions": true,
"generators": true
},
"rules": {
"curly": 0,
......@@ -22,22 +26,22 @@
"no-trailing-spaces": 0,
"no-unused-expressions": 0,
"comma-spacing": 0,
"semi": 0,
"no-process-exit": 0,
"quotes": [0, "double"],
"linebreak-style": [1,"unix"],
"mocha/no-exclusive-tests": 2,
"no-undef": [2],
"no-process-exit": [1],
"indent": [1,2],
"no-eval": [1],
"comma-dangle": [1],
"eol-last": [1],
"no-shadow": [1],
"no-unused-vars": [1],
"no-unused-vars": [1, { "varsIgnorePattern": "should"}],
"space-infix-ops": [1],
"handle-callback-err": [1],
"semi": [1,"always"],
"no-extra-semi": [1]
},
"env": {
......
This project is now tracked on our hosted gitlab server at:
https://git.duniter.org/nodes/typescript/duniter
The current github repository is a simple clone taken up to date at each push on the main gitlab repository.
All contributions should be performed on the main gitlab repository.
Pull requests proposed on github would generate more work for the main contributors.
Issues can be submitted on github. However, all issues created on github will be duplicated on gitlab manually and closed with a link to the gitlab issue.
Please note that all issues should be preferentially opened at
https://git.duniter.org/nodes/typescript/duniter/issues/new?issue
If you open issue here, it will be duplicated manually on our hosted gitlab and closed here with a link to our main repository.
Thank you for your understanding.
This project is now tracked on our hosted gitlab server at:
https://git.duniter.org/nodes/typescript/duniter/gitlab
The current github repository is a simple clone taken up to date at each push on the main gitlab repository.
All contributions should be performed on the main gitlab repository.
Pull requests proposed on github would generate more work for the main contributors, therefore we would really appreciate if you can create instead merge requests on our hosted gitlab instance.
Thank you for your understanding.
# Initial disclaimer
This project is now tracked on our hosted gitlab server at:
https://git.duniter.org/nodes/typescript/duniter
The current github repository is a simple clone taken up to date at each push on the main gitlab repository.
All contributions should be performed on the main gitlab repository.
Pull requests proposed on github would generate more work for the main contributors.
Issues can be submitted on github. However, all issues created on github will be duplicated on gitlab manually and closed with a link to the gitlab issue.
# Original README.md
......@@ -4,5 +4,58 @@ node_modules/
npm-debug.log
bin/jpgp*.jar
.idea/
naclb/build
naclb/node_modules
\ No newline at end of file
gui/nw
# Vim swap files
*~
*.swp
*.swo
# Vagrant
.vagrant/
vagrant/*.log
vagrant/duniter
# Python compiled
*.pyc
# Releases
/work
*.deb
*.tar.gz
*.log
*.exe
# vscode
.vscode
# istanbul
.nyc_output
coverage/
# typecode
typedoc/
# files generated by tsc
/index.js*
/index.d.ts
/server.js*
/server.d.ts
*/**/*.js*
app/**/*.d.ts
neon/lib/*.d.ts
test/**/*.d.ts
# files generated by neon
neon/native/artifacts.json
# rust binaries
bin/duniter
neon/native/index.node
target
# files generated by rust tests
neon/native/tests/*.txt
neon/native/tests/wotb-*
test2.bin.gz
**/*.wot
stages:
- tests
- package
- quality
- integration
- prerelease
- release
workflow:
rules:
- changes:
- .gitlab/**/*
- app/**/*
- bin/duniter_js
- neon/**/*
- release/**/*
- rust-bins/**/*
- rust-libs/**/*
- test/**/*
- .gitlab-ci.yml
- Cargo.toml
- Cargo.lock
- index.ts
- package.json
- package-lock.json
- server.ts
.env:
image: registry.duniter.org/docker/duniter-ci:v0.2.0
tags:
- redshift
before_script:
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- export PATH="$HOME/.cargo/bin:$PATH"
- export RUSTFLAGS="-D warnings"
- export NVM_DIR="$HOME/.nvm"
- . "$NVM_DIR/nvm.sh"
- nvm install 10
- nvm use 10
.rust_env:
image: registry.duniter.org/docker/rust/rust-x64-stable-ci:latest
tags:
- redshift
before_script:
- export PATH="$HOME/.cargo/bin:$PATH"
- rustup show && rustc --version && cargo --version
tests:
extends: .env
rules:
- if: $CI_COMMIT_REF_NAME =~ /^wip*$/
when: manual
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_MERGE_REQUEST_ID ||$CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_BRANCH =~ /^release/'
- when: manual
stage: tests
script:
- cargo test --all
- npm i
- npm run format:check
- npm test
# Push coverage to GitLab pages
- tar cvzf coverage.tar.gz coverage/
# Code coverage display in GitLab
- sed -n 23p coverage/index.html | grep -Po "\d+.\d+" | sed -e "s/\(.*\)/<coverage>\1%<\/coverage>/"
coverage: '/<coverage>(\d+.\d+\%)<\/coverage>/'
artifacts:
paths:
- coverage.tar.gz
expire_in: 72h
fmt_and_clippy:
extends: .env
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_MERGE_REQUEST_ID
- when: on_success
stage: quality
script:
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- export PATH="$HOME/.cargo/bin:$PATH"
- cargo fmt -- --version
- cargo fmt -- --check
- cargo clippy -- -V
- cargo clippy --all --tests -- -D warnings --verbose
audit_dependencies:
extends: .rust_env
before_script:
- cargo deny -V
stage: quality
script:
- cargo deny --workspace check
.integration_rules:
allow_failure: true
rules:
- if: $CI_COMMIT_TAG
when: never
- when: manual
sync_g1:
extends:
- .env
- .integration_rules
stage: integration
script:
- npm i
- bash .gitlab/test/check_g1_sync.sh
sync_gtest:
extends:
- .env
- .integration_rules
stage: integration
script:
- npm i
- bash .gitlab/test/check_gt_sync.sh
.build_releases:
stage: package
image: duniter/release-builder:v2.1.0
cache: {}
tags:
- redshift
artifacts:
paths: &releases_artifacts
- work/bin/
releases:test:
extends: .build_releases
allow_failure: true
rules:
- if: $CI_COMMIT_TAG
when: never
- when: manual
script:
- rm -rf node_modules/
- bash "release/arch/linux/build-lin.sh" "$(date +%Y%m%d).$(date +%H%M).$(date +%S)"
artifacts:
paths: *releases_artifacts
expire_in: 72h
releases:x64:
extends: .build_releases
rules:
- if: $CI_COMMIT_TAG
script:
- rm -rf node_modules/
- bash "release/arch/linux/build-lin.sh" "${CI_COMMIT_TAG#v}"
artifacts:
paths: *releases_artifacts
expire_in: 6 mos
.docker-build-app-image:
stage: package
image: docker:git
tags:
- docker
script:
- docker pull $CI_REGISTRY_IMAGE:$IMAGE_TAG || true
- docker build --cache-from $CI_REGISTRY_IMAGE:$IMAGE_TAG --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" --build-arg="INSTALL_DEX=$INSTALL_DEX" -f release/docker/Dockerfile .
#- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
#- docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
# Temporary push on dockerhub
- docker login -u "duniterteam" -p "$DUNITERTEAM_PASSWD"
- docker tag "$CI_REGISTRY_IMAGE:$IMAGE_TAG" "duniter/duniter:$IMAGE_TAG"
- docker push "duniter/duniter:$IMAGE_TAG"
package:test:docker-test-image:
extends: .docker-build-app-image
allow_failure: true
rules:
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_COMMIT_BRANCH == "dev"'
when: never
- when: manual
variables:
IMAGE_TAG: "test-image"
INSTALL_DEX: "yes"
package:dev:docker:
extends: .docker-build-app-image
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == "dev"
variables:
IMAGE_TAG: "dev"
INSTALL_DEX: "yes"
package:prod:docker:
stage: package
rules:
- if: $CI_COMMIT_TAG
image: docker:git
tags:
- docker
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" -f release/docker/Dockerfile .
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
- docker login -u "duniterteam" -p "$DUNITERTEAM_PASSWD"
- docker tag "$CI_REGISTRY_IMAGE:$CI_BUILD_TAG" "duniter/duniter:$CI_BUILD_TAG"
- docker push "duniter/duniter:$CI_COMMIT_TAG"
- docker tag "$CI_REGISTRY_IMAGE:$CI_BUILD_TAG" duniter/duniter
- docker push duniter/duniter
.release_jobs:
image: rdadev/jinja2:py3.6
tags:
- redshift
script:
- python3 .gitlab/releaser
prerelease:
extends: .release_jobs
rules:
- if: $CI_COMMIT_TAG
stage: prerelease
variables:
RELEASE_BIN_DIR: work/bin/
SOURCE_EXT: '["tar.gz", "zip"]'
publish:
extends: .release_jobs
rules:
- if: $CI_COMMIT_TAG
when: manual
stage: release
variables:
RELEASE_BIN_DIR: work/bin/
WIKI_RELEASE: Releases
allow_failure: false
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CI pages</title>
<style>
html, body {
font-family: "Courier New", Consolas, monospace;
}
li {
line-height: 25px;
}
</style>
</head>
<body>
<p>
<img src="https://raw.github.com/duniter/duniter/master/images/250%C3%97250.png"/>
</p>
<h1>Continuous Integration (CI) pages:</h1>
<p>
<ul>
<li><a href="https://nodes.duniter.io/typescript/duniter/typedoc/">Typedoc (`{BRANCH}` branch)</a></li>
<li><a href="https://nodes.duniter.io/typescript/duniter/coverage/">Coverage (`{BRANCH}` branch)</a></li>
</ul>
</p>
</body>
</html>
\ No newline at end of file
{% block prerelease %}
# :gift: Pre-release
[Go to Pipeline page :arrow_forward:](https://git.duniter.org/nodes/typescript/duniter/pipelines/{{pipeline}})
{% endblock %}
{% block release %}
# :white_check_mark: Release
{% endblock %}
{% block notebody %}
<placeholder content="end-title" />
<placeholder content="note">
{{current_message}}
</placeholder>
## Downloads
| Category | Arch | Type | Size | File |
|----------|------|------|------|------|
{% for artifact in artifacts %}
| {{artifact.category}} | {{artifact.arch}} | {{artifact.type}} | {{artifact.size}} | [{{artifact.icon}} {{artifact.name}}]({{artifact.url}}) |
{% endfor %}
{% endblock %}
{% block previouswiki %}
## {{tag}}
{{body}}
{% endblock %}
'''
This module is meant add release notes in gitlab for the current project.
Expects to find in environment following variables:
- CI_PROJECT_URL - Automatically set by gitlab-ci
- CI_PROJECT_ID - Automatically set by gitlab-ci
- CI_COMMIT_TAG - Automatically set by gitlab-ci
- CI_PIPELINE_ID - Automatically set by gitlab-ci
- RELEASE_BIN_DIR - Directory where releases are to be found
- SOURCE_EXT - Source extensions (pre-release only)
- WIKI_RELEASE - Wiki page where releases are stored (release only)
- RELEASER_TOKEN - Token used by technical user
'''
from releaser import Releaser
Releaser().release()
class Artifact:
'''
An artifact to be uploaded.
'''
def __init__(self, file_name, category, arch, dtype, icon):
'''
:param file_name: The name of the artifact file (may have directory).
:param category: The category (OS, distrib) for the artifact.
:param arch: The architecture name.
:param dtype: The delivery type (either server or desktop).
:param icon: The name of the icon to be used for artifact representation.
:type file_name: str
:type category: str
:type arch: str
:type dtype: str
:type icon: str
'''
self.file_name = file_name
self.category = category
self.arch = arch
self.dtype = dtype
self.icon = icon
def __lt__(self, other):
if not isinstance(other, Artifact): raise TypeError()
return self.category < other.category or \
(self.category == other.category and self.arch < other.arch) or \
(self.category == other.category and self.arch == other.arch and self.dtype < other.dtype)
def __le__(self, other):
if not isinstance(other, Artifact): raise TypeError()
return self.category <= other.category or \
(self.category == other.category and self.arch <= other.arch) or \
(self.category == other.category and self.arch == other.arch and self.dtype <= other.dtype)
def __eq__(self, other):
if not isinstance(other, Artifact): raise TypeError()
return self.category == other.category and self.arch == other.arch and self.dtype == other.dtype
def __ne__(self, other):
if not isinstance(other, Artifact): raise TypeError()
return self.category != other.category or self.arch != other.arch or self.dtype != other.dtype
def __gt__(self, other):
if not isinstance(other, Artifact): raise TypeError()
return self.category > other.category or \
(self.category == other.category and self.arch > other.arch) or \
(self.category == other.category and self.arch == other.arch and self.dtype > other.dtype)
def __ge__(self, other):
if not isinstance(other, Artifact): raise TypeError()
return self.category >= other.category or \
(self.category == other.category and self.arch >= other.arch) or \
(self.category == other.category and self.arch == other.arch and self.dtype >= other.dtype)
def to_dict(self):
'''
:return: A dictionnary containing artifact data.
:rtype: dict
'''
return {
'name': self.file_name.split('/')[-1],
'category': self.category,
'arch': self.arch,
'type': self.dtype,
'url': self._build_url(),
'size': self._get_size(),
'icon': ':{}:'.format(self.icon)
}
def _get_size(self):
'''
:return: The size of the artifact.
:rtype: FSItemSize
'''
raise NotImplementedError()
def _build_url(self):
'''
:return: The URL which can be used to get this artifact.
:rtype: str
'''
raise NotImplementedError()
import json
import os
from artifact import Artifact
from fsitemsize import FSItemSize
class BinArtifact(Artifact):
'''
A binary artifact.
'''
def __init__(self, folder, desc_file, desc_ext):
'''
:param folder: The folder where files can be found.
:param desc_file: The name of the description file.
:param desc_ext: The extention of the description file.
:type folder: str
:type desc_file: str
:type desc_ext: str
'''
try:
description = json.load(open(desc_file))
except json.decoder.JSONDecodeError:
print('CRITICAL Description file {} could not be read'.format(desc_file))
exit(1)
self.tag = description['version']
self.job = description['job']
file_name = desc_file[:-len(desc_ext)]
Artifact.__init__(self, file_name, description['category'], description['arch'], description['type'], 'package')
def _get_size(self):
return FSItemSize(int(os.path.getsize(self.file_name)))
def _build_url(self):
return '{}/-/jobs/{}/artifacts/raw/{}'.format(
os.environ['CI_PROJECT_URL'], self.job, self.file_name)
import math
class FSItemSize:
'''
The size of a file system item.
'''
def __init__(self, bsize = None):
'''
:param bsize: Size of item in bytes.
:type bsize: int
'''
self.bsize = bsize
def __str__(self):
'''
:return: Human readable size.
:rtype: str
'''
if self.bsize is None:
return '(unknown)'
elif self.bsize == 0:
return '0 B'
size_name = ('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')
i = int(math.floor(math.log(self.bsize, 1024)))
power = math.pow(1024, i)
size = round(self.bsize / power, 2)
return '{} {}'.format(size, size_name[i])
import urllib.request
from projectapi import ProjectApi
class Job(ProjectApi):
'''
Job data API.
'''
def __init__(self, job_id):
'''
:param job_id: The job id.
:type job_id: int
'''
ProjectApi.__init__(self, '/jobs/{}'.format(job_id))
def keep_artifacts(self):
'''
Force artifacts to be kept forever.
'''
request = self.build_request('/artifacts/keep', method='POST')
urllib.request.urlopen(request)
class PlaceHolder:
'''
Placeholder tags in Markdown texts.
'''
__PLACEHOLDER_PART = '<placeholder'
__PLACEHOLDER_START = '<placeholder content="{}">'
__PLACEHOLDER_STOP = '</placeholder>'
__PLACEHOLDER_FULL = '<placeholder content="{}" />'
def __init__(self, content_id):
'''
:param content_id: The identifier to be used for placeholder content.
:type content_id: str
'''
self.ph_start = PlaceHolder.__PLACEHOLDER_START.format(content_id)
self.ph_stop = PlaceHolder.__PLACEHOLDER_STOP
self.ph_full = PlaceHolder.__PLACEHOLDER_FULL.format(content_id)
def get_content(self, text):
'''
:param text: The text in which to extract content.
:type text: str
:return: The content between placeholder markers.
:rtype: str
'''
pos = text.find(self.ph_start)
if pos >= 0:
text = text[pos + len(self.ph_start):]
pos = text.find(self.ph_stop)
if pos >= 0: text = text[:pos]
return text
def get_before(self, text, keep_mark=False):
'''
:param text: The text in which to extract content.
:param keep_mark: If true, the mark is kept in final text.
:type text: str
:type keep_mark: bool
:return: The content before (full) placeholder marker.
:rtype: str
'''
pos = text.find(self.ph_full)
if pos >= 0:
if keep_mark: pos += len(self.ph_full)
text = text[:pos]
return text
def get_after(self, text, keep_mark=False):
'''
:param text: The text in which to extract content.
:param keep_mark: If true, the mark is kept in final text.
:type text: str
:type keep_mark: bool
:return: The content after (full) placeholder marker.
:rtype: str
'''
pos = text.find(self.ph_full)
if pos >= 0:
if not keep_mark: pos += len(self.ph_full)
text = text[pos:]
return text
def replace_content(self, text, content):
'''
:param text: The text in which to extract content.
:param content: The new content to insert.
:type text: str
:type content: str
:return: The text where content has been replaced.
:rtype: str
'''
pos = text.find(self.ph_start)
if pos >= 0:
pos += len(self.ph_start)
text_before = text[:pos]
else:
pos = 0
text_before = ''
pos = text.find(self.ph_stop, pos)
if pos >= 0:
text_after = text[pos:]
else:
text_after = ''
return text_before + content + text_after
def insert_after(self, text, content):
'''
:param text: The text in which to extract content.
:param content: The new content to insert.
:type text: str
:type content: str
:return: The text where content has been inserted.
:rtype: str
'''
pos = text.find(self.ph_full)
if pos >= 0: pos += len(self.ph_full)
else: pos = 0
text_before = text[:pos]
text_after = text[pos:]
return text_before + content + text_after
def clear_all(text):
'''
Clear all placeholders from given text.
:param text: The text to clear.
:type text: str
:return: The clean text.
:rtype: str
'''
while True:
pos = text.find(PlaceHolder.__PLACEHOLDER_PART)
if pos < 0: break
end = text.find('>')
if end < 0: end = len(text)
text = text[:pos] + text[end + 1:]
while True:
pos = text.find(PlaceHolder.__PLACEHOLDER_STOP)
if pos < 0: break
text = text[:pos] + text[pos + len(PlaceHolder.__PLACEHOLDER_STOP):]
return text
import os
import urllib.request
class ProjectApi:
'''
Gitlab API project access.
'''
__PROJECT_URL = 'https://git.duniter.org/api/v4/projects/{}'
def __init__(self, url=''):
'''
:param url: The URL portion to add to base project URL (if needed).
:type url: str
'''
self.base_url = ProjectApi.__PROJECT_URL.format(os.environ['CI_PROJECT_ID'])
self.base_url += url
self.token = ('Private-Token', os.environ['RELEASER_TOKEN'])
def build_request(self, url='', **params):
'''
Create the request to send to project API.
:param url: The portion of URL to add to base URL (if needed).
:param params: The optional parameters.
:type url: str
:type params: dict
:return: The request, ready to be used.
:rtype: urllib.request.Request
'''
request = urllib.request.Request(self.base_url + url, **params)
request.add_header(*self.token)
return request