Compare commits

...

4 Commits

Author SHA1 Message Date
Tommy Verrall 5bf36f1367 cargo update
removed windows headings
changed scripts for building
2021-11-10 11:44:20 +00:00
Mark Sinclair 5da1d89501 Update webview version - see https://github.com/tauri-apps/tauri/issues/2570#issuecomment-916780781
Ignore output in `dist`
2021-11-10 09:29:19 +00:00
Mark Sinclair d7090ecb5a Add webpack config for prod 2021-11-10 09:06:16 +00:00
Mark Sinclair 1a1a2a0355 Build nym wallet with GH Actions 2021-11-10 08:45:43 +00:00
16 changed files with 1455 additions and 675 deletions
-142
View File
@@ -1,142 +0,0 @@
name: Continuous integration
on:
push:
paths-ignore:
- 'explorer/**'
pull_request:
paths-ignore:
- 'explorer/**'
jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.os == 'windows-latest' }}
strategy:
matrix:
rust: [stable, beta, nightly]
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get install libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev squashfs-tools
if: matrix.os == 'ubuntu-latest'
- name: Check out repository code
uses: actions/checkout@v2
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
components: rustfmt, clippy
- name: Build all binaries
uses: actions-rs/cargo@v1
with:
command: build
args: --all
- name: Run all tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run clippy
uses: actions-rs/cargo@v1
if: ${{ matrix.rust != 'nightly' }}
with:
command: clippy
args: -- -D warnings
# COCONUT stuff
- name: Reclaim some disk space (because Windows is being annoying)
uses: actions-rs/cargo@v1
if: ${{ matrix.os == 'windows-latest' }}
with:
command: clean
# BUILD
- name: Build gateway with coconut feature
uses: actions-rs/cargo@v1
with:
command: build
args: --bin nym-gateway --features=coconut
- name: Build native client with coconut feature
uses: actions-rs/cargo@v1
with:
command: build
args: --bin nym-client --features=coconut
- name: Build socks5 client with coconut feature
uses: actions-rs/cargo@v1
with:
command: build
args: --bin nym-socks5-client --features=coconut
- name: Build validator-api with coconut feature
uses: actions-rs/cargo@v1
with:
command: build
args: --bin nym-validator-api --features=coconut
# TEST
- name: Test gateway with coconut feature
uses: actions-rs/cargo@v1
with:
command: test
args: --bin nym-gateway --features=coconut
- name: Test native client with coconut feature
uses: actions-rs/cargo@v1
with:
command: test
args: --bin nym-client --features=coconut
- name: Test socks5 client with coconut feature
uses: actions-rs/cargo@v1
with:
command: test
args: --bin nym-socks5-client --features=coconut
- name: Test validator-api with coconut feature
uses: actions-rs/cargo@v1
with:
command: test
args: --bin nym-validator-api --features=coconut
# CLIPPY
- name: Run clippy on gateway with coconut feature
uses: actions-rs/cargo@v1
with:
command: clippy
args: --bin nym-gateway --features=coconut -- -D warnings
- name: Run clippy on native client with coconut feature
uses: actions-rs/cargo@v1
with:
command: clippy
args: --bin nym-client --features=coconut -- -D warnings
- name: Run clippy on socks5 client with coconut feature
uses: actions-rs/cargo@v1
with:
command: clippy
args: --bin nym-socks5-client --features=coconut -- -D warnings
- name: Run clippy on validator-api with coconut feature
uses: actions-rs/cargo@v1
with:
command: clippy
args: --bin nym-validator-api --features=coconut -- -D warnings
-17
View File
@@ -1,17 +0,0 @@
name: Clippy check
on:
push:
paths-ignore:
- 'explorer/**'
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
-50
View File
@@ -1,50 +0,0 @@
name: Mixnet Contract
on:
push:
paths-ignore:
- 'explorer/**'
pull_request:
paths-ignore:
- 'explorer/**'
jobs:
mixnet-contract:
# since it's going to be compiled into wasm, there's absolutely
# no point in running CI on different OS-es
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.rust == 'nightly' }}
strategy:
matrix:
rust: [ stable, beta, nightly ]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: wasm32-unknown-unknown
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path contracts/mixnet/Cargo.toml --target wasm32-unknown-unknown
- uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path contracts/mixnet/Cargo.toml
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path contracts/mixnet/Cargo.toml -- --check
- uses: actions-rs/cargo@v1
if: ${{ matrix.rust != 'nightly' }}
with:
command: clippy
args: --manifest-path contracts/mixnet/Cargo.toml -- -D warnings
@@ -1,23 +0,0 @@
name: Linting for Network Explorer (eslint/prettier)
on:
pull_request:
paths:
- 'explorer/**'
defaults:
run:
working-directory: explorer
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
- name: Run ESLint
# GitHub should automatically annotate the PR
run: npm run lint
-57
View File
@@ -1,57 +0,0 @@
name: CI for Network Explorer
on:
push:
paths:
- 'explorer/**'
defaults:
run:
working-directory: explorer
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rsync
run: sudo apt-get install rsync
- uses: rlespinasse/github-slug-action@v3.x
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm install
continue-on-error: true
- run: npm run test
continue-on-error: true
- run: npm run build
continue-on-error: true
- name: Deploy branch to CI www
continue-on-error: true
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.CI_WWW_SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "explorer/dist/"
REMOTE_HOST: ${{ secrets.CI_WWW_REMOTE_HOST }}
REMOTE_USER: ${{ secrets.CI_WWW_REMOTE_USER }}
TARGET: ${{ secrets.CI_WWW_REMOTE_TARGET }}/network-explorer-${{ env.GITHUB_REF_SLUG }}
EXCLUDE: "/dist/, /node_modules/"
- name: Keybase - Node Install
run: npm install
working-directory: .github/workflows/support-files/messages
- name: Keybase - Send Notification
env:
NYM_PROJECT_NAME: "Network Explorer"
NYM_CI_WWW_BASE: "${{ secrets.NYM_CI_WWW_BASE }}"
NYM_CI_WWW_LOCATION: "network-explorer-${{ env.GITHUB_REF_SLUG }}"
GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
GIT_BRANCH: "${GITHUB_REF##*/}"
KEYBASE_NYMBOT_USERNAME: "${{ secrets.KEYBASE_NYMBOT_USERNAME }}"
KEYBASE_NYMBOT_PAPERKEY: "${{ secrets.KEYBASE_NYMBOT_PAPERKEY }}"
KEYBASE_NYMBOT_TEAM: "${{ secrets.KEYBASE_NYMBOT_TEAM }}"
KEYBASE_NYM_CHANNEL: "ci-network-explorer"
IS_SUCCESS: "${{ job.status == 'success' }}"
uses: docker://keybaseio/client:stable-node
with:
args: .github/workflows/support-files/messages/entry_point_notifications.sh
-77
View File
@@ -1,77 +0,0 @@
name: Webdriverio tests for nym wallet
on:
push:
paths:
- 'tauri-wallet/**'
defaults:
run:
working-directory: tauri-wallet
jobs:
test:
name: wallet tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Tauri dependencies
run: >
sudo apt-get update &&
sudo apt-get install -y
libgtk-3-dev
libgtksourceview-3.0-dev
webkit2gtk-4.0
libappindicator3-dev
webkit2gtk-driver
xvfb
- name: Install minimal stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Node v16
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Install yarn for building application
run: yarn install
- name: Build application
run: yarn run webpack:build & yarn run tauri:build
- name: Check binary exists
run: |
cd target/release/
(test -f nym-wallet && echo nym binary exists) || echo wallet does not exist
- name: Install dependencies
run: yarn install
working-directory: tauri-wallet/webdriver
- name: Remove existing user datafile
uses: JesseTG/rm@v1.0.2
with:
path: tauri-wallet/webdriver/common/data/user-data.json
- name: Create user data json file
id: create-json
uses: jsdaniell/create-json@1.1.2
with:
name: "user-data.json"
json: ${{ secrets.WALLET_USERDATA }}
dir: 'tauri-wallet/webdriver/common/data/'
- name: Install tauri-driver
uses: actions-rs/cargo@v1
with:
command: install
args: tauri-driver
- name: Launch tests
run: xvfb-run yarn test:runall
working-directory: tauri-wallet/webdriver
+128 -4
View File
@@ -1,12 +1,136 @@
name: Publish Tauri Wallet
name: Publish Nym Wallet
on:
push:
tags:
- tauri-wallet-*
branches:
- feature/gh-action-build-tauri-wallet
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: tauri-wallet
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15, macos-11, windows-latest]
outputs:
PACKAGE_VERSION: ${{ steps.package-node-version.outputs.version }}
steps:
- name: Run a one-line script
run: echo Hello, world!
- uses: actions/checkout@v2
- name: Tauri dependencies
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: >
sudo apt-get update &&
sudo apt-get install -y
libgtk-3-dev
libgtksourceview-3.0-dev
webkit2gtk-4.0
libappindicator3-dev
webkit2gtk-driver
xvfb
- name: Install minimal stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Node v16
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Read node from package.json
uses: culshaw/read-package-node-version-actions@v1
with:
path: "${{github.workspace}}/tauri-wallet"
id: package-node-version
- name: Install yarn for building application
run: yarn install
- name: Build application (bundle)
run: yarn run webpack:build
- name: Build application (tauri)
run: yarn run tauri:build
# - name: Fake build
# run: |
# mkdir release-assets
# cp package.json release-assets/${{ matrix.os }}-${{ steps.package-node-version.outputs.version }}.zip
- name: Compress (MacOS / Linux)
if: ${{ matrix.os != 'windows-latest' }}
working-directory: tauri-wallet
env:
TARGET_FILE: ${{ matrix.os }}_v${{ steps.package-node-version.outputs.version }}.tar.gz
run: |
mkdir release-assets
pushd target/release/bundle
tar -cvzf ../../../release-assets/$TARGET_FILE .
- name: Compress (Windows)
if: ${{ matrix.os == 'windows-latest' }}
uses: thedoctor0/zip-release@master
with:
type: 'zip'
filename: '${{github.workspace}}/tauri-wallet/release-assets/${{ runner.os }}_v${{ steps.package-node-version.outputs.version }}.zip'
path: "${{github.workspace}}/tauri-wallet/target/release/bundle"
- name: Upload release assets
uses: actions/upload-artifact@v2
with:
name: release-assets-${{ matrix.os }}
path: "${{github.workspace}}/tauri-wallet/release-assets/*"
release:
needs: build
runs-on: ubuntu-latest
env:
PACKAGE_VERSION: ${{ needs.build.outputs.PACKAGE_VERSION }}
steps:
- uses: actions/checkout@v2
- name: Download assets
uses: actions/download-artifact@v2
with:
path: download-assets
- name: Display downloaded assets
run: ls -R download-assets
- name: Re-arrange downloaded assets
run: |
mkdir release-assets
find download-assets -mindepth 2 -type f -exec mv -t ${{github.workspace}}/release-assets -i '{}' +
rm -rf download-assets
- name: Hash files
id: file_hashes
# Put the multi-line string in an env var and create a new action env var by wrapping the multiline value
run: |
cd release-assets
ASSET_HASHES=$(find . -type f -exec sha256sum {} \;)
echo "ASSET_HASHES<<EOF" >> $GITHUB_ENV
echo "$ASSET_HASHES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Display file hashes
run: echo $ASSET_HASHES
- uses: ncipollo/release-action@v1
with:
# The pipe syntax needs to stay to escape the wildcard correctly
artifacts: |
release-assets/*
token: ${{ secrets.GITHUB_TOKEN }}
tag: "nym-wallet-v${{env.PACKAGE_VERSION}}"
commit: feature/gh-action-build-tauri-wallet
draft: true
name: "Nym Wallet v${{ env.PACKAGE_VERSION }}"
body: |
This is a build of the Nym Wallet from commit `${{ github.sha }}` [(browse commit)](https://github.com/nymtech/nym/tree/${{ github.sha }}).
Installers for each operating system have the following SHA256 hashes:
```
${{ env.ASSET_HASHES }}
```
-29
View File
@@ -1,29 +0,0 @@
name: Generate TS types
on:
push:
paths-ignore:
- 'explorer/**'
pull_request:
paths-ignore:
- 'explorer/**'
jobs:
tauri-wallet-types:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Prepare
run: sudo apt-get update && sudo apt-get install -y libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-dev libsoup2.4-dev librust-gdk-dev libwebkit2gtk-4.0-dev
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Generate TS
run: cd tauri-wallet/src-tauri && cargo test
- uses: EndBug/add-and-commit@v7.2.1 # https://github.com/marketplace/actions/add-commit
with:
add: '["tauri-wallet"]'
message: '[ci skip] Generate TS types'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-50
View File
@@ -1,50 +0,0 @@
name: Wasm Client
on:
push:
paths-ignore:
- 'explorer/**'
pull_request:
paths-ignore:
- 'explorer/**'
jobs:
wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown
- uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown --features=coconut
# for some reason this does not seem to work correctly, leave it for later, building is good enough for now
# - uses: actions-rs/cargo@v1
# with:
# command: test
# args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path clients/webassembly/Cargo.toml -- --check
# for some reason this does not seem to work correctly, leave it for later, building is good enough for now
# - uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: --manifest-path clients/webassembly/Cargo.toml --target wasm32-unknown-unknown -- -D warnings
+1
View File
@@ -0,0 +1 @@
dist
+266 -183
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -1,15 +1,15 @@
{
"name": "tauri-app",
"version": "1.0.0",
"version": "0.0.1-gh-action-test",
"main": "index.js",
"license": "MIT",
"scripts": {
"webpack:dev": "yarn webpack serve",
"webpack:build": "yarn webpack",
"webpack:build": "yarn webpack --progress --config webpack.prod.config.js",
"tauri:dev": "yarn tauri dev",
"tauri:build": "yarn tauri build",
"dev": "yarn run webpack:dev & yarn run tauri:dev",
"build": "yarn run webpack:build & yarn run tauri:build"
"dev": "run-p webpack:dev tauri:dev",
"build": "run-s webpack:build tauri:build"
},
"dependencies": {
"@babel/preset-typescript": "^7.15.0",
@@ -43,9 +43,11 @@
"@types/semver": "^7.3.8",
"babel-loader": "^8.2.2",
"css-loader": "^6.2.0",
"favicons": "^6.2.2",
"favicons-webpack-plugin": "^5.0.2",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.2",
"npm-run-all": "^4.1.5",
"style-loader": "^3.2.1",
"url-loader": "^4.1.1",
"webpack": "^5.50.0",
-8
View File
@@ -5,7 +5,6 @@
use mixnet_contract::{Gateway, MixNode};
use std::sync::Arc;
use tauri::{Menu, MenuItem};
use tokio::sync::RwLock;
use ts_rs::export;
use validator_client::nymd::fee_helpers::Operation;
@@ -36,12 +35,6 @@ macro_rules! format_err {
};
}
pub fn create_menu_items() -> Menu {
Menu::new()
.add_native_item(MenuItem::Copy)
.add_native_item(MenuItem::Paste)
}
fn main() {
tauri::Builder::default()
.manage(Arc::new(RwLock::new(State::default())))
@@ -65,7 +58,6 @@ fn main() {
update_state_params,
get_reverse_mix_delegations_paged,
])
.menu(create_menu_items())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
+6 -3
View File
@@ -4,7 +4,10 @@ var path = require('path')
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, '/src/index'),
node: {
__dirname: false
},
entry: path.resolve(__dirname, 'src/index'),
devServer: {
port: 9000,
compress: true,
@@ -13,10 +16,10 @@ module.exports = {
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'public/index.html'),
template: path.resolve(__dirname, './public/index.html'),
filename: 'index.html',
}),
new FaviconsWebpackPlugin(path.resolve(__dirname, 'public/favicon.ico')),
new FaviconsWebpackPlugin(path.resolve(__dirname, './public/favicon.ico')),
],
module: {
rules: [
+42
View File
@@ -0,0 +1,42 @@
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FaviconsWebpackPlugin = require('favicons-webpack-plugin')
var path = require('path')
module.exports = {
mode: 'production',
node: {
__dirname: false
},
entry: path.resolve(__dirname, './src/index'),
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './public/index.html'),
filename: 'index.html',
}),
new FaviconsWebpackPlugin(path.resolve(__dirname, './src/images/logo.png')),
],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
use: [
{
loader: 'file-loader',
},
],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
},
}
+1004 -26
View File
File diff suppressed because it is too large Load Diff