Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kdense521 authored and stechu committed Jan 13, 2022
1 parent 0879a43 commit 92c2086
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 13 deletions.
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v ✰ Thanks for creating a PR! ✰
v Before hitting that submit button please review the checkboxes.
v If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->

## Description

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review.
-->

closes: #XXXX

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [ ] Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
- [ ] Test following procedure in docs/testing-workflow.md
- [ ] Updated relevant documentation in the code.
- [ ] Re-reviewed `Files changed` in the Github PR explorer.
- [ ] Update the version numbers properly:
* Cargo.toml
* ui/src-tauri/Cargo.toml
* ui/src-tauri/tauri.conf.json
* ui/public/about.html
* ui/package.json
124 changes: 124 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Build and upload binaries

on:
pull_request:
branches:
- master
release:
types: [published]

jobs:
setup:
name: Get version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo "VERSION=$(cat Cargo.toml | grep ^version | awk -F'=' '{print $2}' | tr -d '\" ')" >> $GITHUB_ENV
outputs:
release_version: ${{ env.VERSION }}
build:
name: Build
needs: setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
os_type: ubuntu
artifact_name: manta-signer
asset_name: manta-signer-linux-amd64
- os: windows-2019
os_type: windows
artifact_name: manta-signer
asset_name: manta-signer-windows
- os: macos-latest
os_type: macos
artifact_name: manta-signer
asset_name: manta-signer-macos-amd64
- os: macos-10.15
os_type: macos
artifact_name: manta-signer
asset_name: manta-signer-macos-amd64
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache Cargo build dir
uses: actions/cache@v2
env:
cache-name: cache-cargo
with:
path: ~/.cargo
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./ui/src-tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache target dir
uses: actions/cache@v2
env:
cache-name: cache-target
with:
path: ui/src-tauri/target
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./ui/src-tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Fetch reclaim_pk.bin
run: cd ui/src-tauri;curl -OL 'https://github.com/Manta-Network/sdk/raw/main/zkp/reclaim_pk.bin'
- name: Fetch transfer_pk.bin
run: cd ui/src-tauri;curl -OL 'https://github.com/Manta-Network/sdk/raw/main/zkp/transfer_pk.bin'
- name: Hack For Ubuntu Builds
run: cd ui/src-tauri; sed -i /icns/d tauri.conf.json
if: matrix.os_type == 'ubuntu'
- name: Ubuntu Build Dependencies
run: sudo apt-get update && sudo apt-get -y install libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev patchelf librsvg2-dev
if: matrix.os_type == 'ubuntu'
- name: Build
run: cd ui;yarn && yarn tauri build
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'release' && github.event.action == 'published'
- name: Upload .deb Package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ui/src-tauri/target/release/bundle/deb/manta-signer_${{ needs.setup.outputs.release_version }}_amd64.deb
asset_name: manta-signer-${{ matrix.os }}_${{ needs.setup.outputs.release_version }}_amd64.deb
asset_content_type: application/binary
if: matrix.os_type == 'ubuntu' && github.event_name == 'release' && github.event.action == 'published'
- name: Upload AppImage Package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ui/src-tauri/target/release/bundle/appimage/manta-signer_${{ needs.setup.outputs.release_version }}_amd64.AppImage
asset_name: manta-signer-${{ matrix.os }}_${{ needs.setup.outputs.release_version }}_amd64.AppImage
asset_content_type: application/binary
if: matrix.os_type == 'ubuntu' && github.event_name == 'release' && github.event.action == 'published'
- name: Upload MS Installer
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: "ui/src-tauri/target/release/bundle/msi/manta-signer_${{ needs.setup.outputs.release_version }}_x64.msi"
asset_name: "manta-signer-${{ matrix.os }}_${{ needs.setup.outputs.release_version }}_x64.msi"
asset_content_type: application/binary
if: matrix.os_type == 'windows' && github.event_name == 'release' && github.event.action == 'published'
- name: Upload Mac Image
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: "ui/src-tauri/target/release/bundle/dmg/manta-signer_${{ needs.setup.outputs.release_version }}_x64.dmg"
asset_name: "manta-signer-${{ matrix.os }}_${{ needs.setup.outputs.release_version }}_x64.dmg"
asset_content_type: application/binary
if: matrix.os_type == 'macos' && github.event_name == 'release' && github.event.action == 'published'
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "manta-signer"
edition = "2018"
version = "0.5.0"
version = "0.5.1"
authors = ["Manta Network <contact@manta.network>"]
readme = "README.md"
license-file = "LICENSE"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Disclaimer: `manta-signer` is experimental software, use it at your own risk.
-src: manta-signer zkp generation
-ui: manta-signer desktop UI
```

4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "manta-signer-ui",
"version": "0.5.0",
"version": "0.5.1",
"private": true,
"dependencies": {
"@tauri-apps/api": "^1.0.0-beta.8",
Expand Down Expand Up @@ -43,4 +43,4 @@
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-beta.10"
}
}
}
4 changes: 2 additions & 2 deletions ui/public/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<main>
<img src="Square89x89Logo.png" />
<h3>Manta Signer</h3>
<p>Version 0.5.0</p>
<p>Version 0.5.1</p>
<p>Copyright © 2019-2021 Manta Network</p>
<p>
<a href="https://github.com/manta-network/manta-signer">manta-network/manta-signer</a>
Expand All @@ -48,4 +48,4 @@ <h3>Manta Signer</h3>
</main>
</body>

</html>
</html>
2 changes: 1 addition & 1 deletion ui/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "manta-signer-ui"
edition = "2018"
version = "0.5.0"
version = "0.5.1"
authors = ["Manta Network <contact@manta.network>"]
readme = "README.md"
license-file = "LICENSE"
Expand Down
16 changes: 15 additions & 1 deletion ui/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ impl User {
/// Pulls resources from `self.resource_directory` and moves them to the proving key directory.
#[inline]
async fn setup_resources(&self, config: &Config) {
// FIXME: Make sure this function will work on all platforms.
if !self.resource_directory.exists().await {
// NOTE: If this file does not exist, then we are in development mode.
return;
Expand All @@ -102,6 +101,21 @@ impl User {
.await
.expect("Copy should have succeeded.");
}
} else if entry.path().to_str().unwrap().ends_with(".bin") {
let mut bins = fs::read_dir(&entry.path())
.await
.expect("The resource directory should be a directory.");
while let Some(entry) = bins.next().await {
let path = entry.expect("Unable to get directory entry.").path();
fs::copy(
&path,
&config
.proving_key_directory
.join(&path.file_name().expect("Path should point to a real file.")),
)
.await
.expect("Copy should have succeeded.");
}
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions ui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "Manta Signer",
"version": "0.5.0"
"productName": "manta-signer",
"version": "0.5.1"
},
"build": {
"distDir": "../build",
Expand All @@ -19,7 +19,6 @@
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": ["*.bin"],
Expand Down Expand Up @@ -71,12 +70,12 @@
"url": "about.html",
"width": 350,
"height": 270,
"alwaysOnTop": true,
"alwaysOnTop": false,
"center": true,
"decorations": true,
"resizable": false,
"transparent": false,
"visible": false
"visible": true
}
],
"security": {
Expand All @@ -87,4 +86,4 @@
"iconAsTemplate": true
}
}
}
}

0 comments on commit 92c2086

Please sign in to comment.