Merge branch 'create-ci' into 'master'

Create CI

See merge request clients/gecko!1
This commit is contained in:
Éloïs 2021-02-26 01:29:18 +00:00
commit ce4b4d7c07
6 changed files with 293 additions and 4 deletions

93
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,93 @@
stages:
- format
- build_and_test
- quality
- package
.env:
image: axiomteam/gecko-ci:v0.0.5
tags:
- redshift
before_script:
- rustup show
- rustc --version && cargo --version
format:
extends: .env
rules:
- if: $CI_COMMIT_REF_NAME =~ /^wip*$/
when: manual
- if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID
- when: manual
stage: format
script:
- cargo fmt -- --version
- cargo fmt -- --check
- flutter format --set-exit-if-changed lib packages/dubp_rs/lib/dubp.dart
build_and_test:
extends: .env
rules:
- if: $CI_COMMIT_REF_NAME =~ /^wip*$/
when: manual
- if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID
- when: manual
stage: build_and_test
tags:
- redshift
script:
- RUSTFLAGS="-D warnings" cargo make
- cd packages/dubp_rs && flutter pub get && cd ../..
- flutter analyze
- cargo test
# - flutter test
lint:
extends: .env
rules:
- if: $CI_COMMIT_REF_NAME =~ /^wip*$/
when: manual
- if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID
- when: manual
stage: quality
script:
- cargo clippy -- -V
- cargo clippy --all --tests -- -D warnings --verbose
audit_dependencies:
extends: .env
rules:
- if: $CI_COMMIT_REF_NAME =~ /^wip*$/
when: manual
- if: $CI_COMMIT_TAG || $CI_MERGE_REQUEST_ID
- when: manual
stage: quality
script:
- cargo deny -V
- cargo deny check
releases:test:
extends: .env
stage: package
allow_failure: true
rules:
- if: $CI_COMMIT_TAG
when: never
- when: manual
script:
- bash "release/android/build-apk.sh" "$(date +%Y%m%d).$(date +%H%M).$(date +%S)+0"
artifacts:
paths: &releases_artifacts
- work/bin/
expire_in: 72h
releases:x64:
extends: .env
stage: package
rules:
- if: $CI_COMMIT_TAG
script:
- bash "release/android/build-apk.sh" "${CI_COMMIT_TAG#v}"
artifacts:
paths: *releases_artifacts
expire_in: 1 mos

117
Cargo.lock generated
View File

@ -122,6 +122,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb"
[[package]]
name = "bumpalo"
version = "3.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
[[package]]
name = "byteorder"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@ -255,9 +261,9 @@ dependencies = [
[[package]]
name = "dup-crypto"
version = "0.43.0"
version = "0.43.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1333e3d4ff5bc8e426cbac23bf3229294e784203ce3d6943a5828c4288a11d8e"
checksum = "5612539417a1204863d10dda1cb313fe7a34da8596d30fa93da8af125c928abb"
dependencies = [
"aes",
"arrayvec",
@ -269,6 +275,7 @@ dependencies = [
"ed25519-bip32",
"getrandom",
"once_cell",
"ring",
"serde",
"thiserror",
"zerocopy",
@ -362,6 +369,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "js-sys"
version = "0.3.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
@ -488,6 +510,21 @@ dependencies = [
]
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin",
"untrusted",
"web-sys",
"winapi",
]
[[package]]
name = "ryu"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@ -531,6 +568,12 @@ dependencies = [
]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spinning_top"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@ -651,6 +694,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@ -669,6 +718,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasm-bindgen"
version = "0.2.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be"
dependencies = [
"cfg-if 1.0.0",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64"
[[package]]
name = "web-sys"
version = "0.3.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"

50
deny.toml Normal file
View File

@ -0,0 +1,50 @@
[bans]
multiple-versions = "warn"
deny = [
# color-backtrace is nice but brings in too many dependencies and that are often outdated, so not worth it for us.
{ name = "color-backtrace" },
# deprecated
{ name = "quickersort" },
# term is not fully maintained, and termcolor is replacing it
{ name = "term" },
]
skip-tree = [
{ name = "winapi", version = "<= 0.3" },
]
[licenses]
unlicensed = "deny"
# We want really high confidence when inferring licenses from text
confidence-threshold = 0.92
allow = [
"AGPL-3.0",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"CC0-1.0",
"ISC",
"MIT",
"MPL-2.0",
"OpenSSL",
"Zlib"
]
[[licenses.clarify]]
name = "ring"
# SPDX considers OpenSSL to encompass both the OpenSSL and SSLeay licenses
# https://spdx.org/licenses/OpenSSL.html
# ISC - Both BoringSSL and ring use this for their new files
# MIT - "Files in third_party/ have their own licenses, as described therein. The MIT
# license, for third_party/fiat, which, unlike other third_party directories, is
# compiled into non-test libraries, is included below."
# OpenSSL - Obviously
expression = "ISC AND MIT AND OpenSSL"
license-files = [
{ path = "LICENSE", hash = 0xbd0eed23 },
]
[sources]
unknown-registry = "deny"
unknown-git = "deny"

View File

@ -19,7 +19,6 @@ class HomeProvider with ChangeNotifier {
Widget appBarTitle = Text('Ğecko', style: TextStyle(color: Colors.grey[850]));
List currentTab = [HistoryScreen(), WalletsHome()];
get currentIndex => _currentIndex;
set currentIndex(int index) {

View File

@ -2,6 +2,7 @@
name = "dubp_rs"
version = "0.1.0"
authors = ["Éloïs SANCHEZ <elois@duniter.org>"]
license = "AGPL-3.0"
edition = "2018"
[lib]
@ -10,7 +11,7 @@ crate-type = ["rlib"]
[dependencies]
allo-isolate = "0.1.6"
dup-crypto = { version = "0.43.0", features = ["bip32-ed25519", "dewif", "mnemonic", "mnemonic_french", "scrypt"] }
dup-crypto = { version = "0.43.2", features = ["bip32-ed25519", "dewif", "mnemonic", "mnemonic_french", "scrypt"] }
fast-threadpool = { version = "0.3.0", default-features = false }
once_cell = { version = "1.3.1", default-features = false, features = ["std"] }
thiserror = "1.0.23"

33
release/android/build-apk.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
if [[ -z "${1}" ]]; then
echo "Fatal: no version given to build script"
exit 1
fi
APPNAME="gecko"
VERSION=$(awk -F '+' '{ print $1 }' <<<${1})
BUILD=$(awk -F '+' '{ print $2 }' <<<${1})
ORI_APP="app-release.apk"
APK_FILENAME="${APPNAME}-${VERSION}+${BUILD}.apk"
echo "artifact name: ${APK_FILENAME}"
## Build Rust dependancies
echo "Compile Rust binding..."
cargo make
# Build APK
echo "Build APK..."
flutter clean
flutter build apk --release --build-name $VERSION --build-number $BUILD
# Create artifacts folder
ARTIFACTS_FOLDER="work/bin"
mkdir -p ${ARTIFACTS_FOLDER}
# Move APK in artifacts folder
APK_PATH="${ARTIFACTS_FOLDER}/${APK_FILENAME}"
mv build/app/outputs/flutter-apk/$ORI_APP "$APK_PATH" || exit 1
exit 0